-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
57 lines (49 loc) · 1.41 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import pkgutil
import dash
import dash_bootstrap_components as dbc
from dash import html
import projects
from utils import LayoutBuilder as LB
from utils.Config import config
app = dash.Dash(
__name__,
pages_folder='',
use_pages=True,
external_stylesheets=[dbc.icons.FONT_AWESOME, dbc.themes.BOOTSTRAP],
)
for module in pkgutil.iter_modules(projects.__path__):
module = getattr(projects, module.name)
dash.register_page(
module.__name__.replace('projects.', ''),
layout=module.layout,
)
dash.register_page(
'home',
path='/',
redirect_from=['/index'],
layout=html.Div(
children=[
html.H1(children='Dashboards'),
html.Div(
children=[
*[
LB.project_card(
title=project.name,
fig=project.fig,
description=project.description,
button_text=project.button_text,
icon=project.icon,
)
for project in config.projects
],
],
className='projects-container',
),
],
className='main-container card',
style={'margin': '1.5rem'},
),
)
app.layout = dash.page_container
if __name__ == '__main__':
app.run_server(debug=True)