Feat: split dashboard
This commit is contained in:
parent
f62c898162
commit
84fcee625d
5
recopytex/dashboard/app.py
Normal file
5
recopytex/dashboard/app.py
Normal file
@ -0,0 +1,5 @@
|
||||
import dash
|
||||
|
||||
app = dash.Dash(__name__, suppress_callback_exceptions=True)
|
||||
# app = dash.Dash(__name__)
|
||||
server = app.server
|
0
recopytex/dashboard/exam_analysis/__init__.py
Normal file
0
recopytex/dashboard/exam_analysis/__init__.py
Normal file
@ -14,9 +14,10 @@ import numpy as np
|
||||
import dash_bootstrap_components as dbc
|
||||
|
||||
|
||||
from .. import flat_df_students, pp_q_scores
|
||||
from ..config import NO_ST_COLUMNS
|
||||
from ..scripts.getconfig import config, CONFIGPATH
|
||||
from ... import flat_df_students, pp_q_scores
|
||||
from ...config import NO_ST_COLUMNS
|
||||
from ...scripts.getconfig import config, CONFIGPATH
|
||||
from ..app import app
|
||||
|
||||
COLORS = {
|
||||
".": "black",
|
||||
@ -26,11 +27,7 @@ COLORS = {
|
||||
3: "#68D42F",
|
||||
}
|
||||
|
||||
# external_stylesheets = ["https://codepen.io/chriddyp/pen/bWLwgP.css"]
|
||||
# app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
|
||||
app = dash.Dash(__name__)
|
||||
|
||||
app.layout = html.Div(
|
||||
layout = html.Div(
|
||||
children=[
|
||||
html.Header(
|
||||
children=[
|
23
recopytex/dashboard/index.py
Normal file
23
recopytex/dashboard/index.py
Normal file
@ -0,0 +1,23 @@
|
||||
import dash_core_components as dcc
|
||||
import dash_html_components as html
|
||||
from dash.dependencies import Input, Output
|
||||
|
||||
from .app import app
|
||||
from .exam_analysis import app as exam_analysis
|
||||
|
||||
|
||||
app.layout = html.Div(
|
||||
[dcc.Location(id="url", refresh=False), html.Div(id="page-content")]
|
||||
)
|
||||
|
||||
|
||||
@app.callback(Output("page-content", "children"), Input("url", "pathname"))
|
||||
def display_page(pathname):
|
||||
if pathname == "/":
|
||||
return exam_analysis.layout
|
||||
else:
|
||||
return "404"
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run_server(debug=True)
|
@ -13,7 +13,7 @@ from .getconfig import config, CONFIGPATH
|
||||
from .prompts import prompt_exam, prompt_exercise, prompt_validate
|
||||
from ..config import NO_ST_COLUMNS
|
||||
from .exam import Exam
|
||||
from ..dashboard.exam import app as exam_app
|
||||
from ..dashboard.index import app as dash
|
||||
|
||||
|
||||
@click.group()
|
||||
@ -89,7 +89,7 @@ def new_exam():
|
||||
@cli.command()
|
||||
@click.option("--debug", default=0, help="Debug mode for dash")
|
||||
def exam_analysis(debug):
|
||||
exam_app.run_server(debug=bool(debug))
|
||||
dash.run_server(debug=bool(debug))
|
||||
|
||||
|
||||
@cli.command()
|
||||
|
Loading…
Reference in New Issue
Block a user