-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloader.py
More file actions
38 lines (33 loc) · 1.16 KB
/
Copy pathloader.py
File metadata and controls
38 lines (33 loc) · 1.16 KB
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
import dash
import configparser
import data
import dash_bootstrap_components as dbc
import os
from html2dash import Html2Dash
import json_path
import web_requests
CONFIG = 'multipage_config.ini'
STYLES = [dbc.themes.LUX, './styles/app.css']
SCRIPTS = []
model = data
config = configparser.ConfigParser()
config.read(CONFIG)
page_name = None
if config.getboolean('app', 'UsePages'):
try:
os.mkdir('./pages')
except FileExistsError:
pass
html2dash = Html2Dash(config, 'pages', True)
for file in [f'./layouts/{x}' for x in os.listdir('./layouts') if x.endswith('.html')]:
html2dash.convert(file, '/' if file.endswith(config['app']['MainPage']) else None)
app = dash.Dash(__name__, use_pages=True, external_stylesheets=STYLES, external_scripts=SCRIPTS, meta_tags=[
{
"name": "viewport",
"content": "width=device-width, initial-scale=1, maximum-scale=1",
}
])
else:
html2dash = Html2Dash(config, 'cache', False)
page_name = html2dash.convert(f'./layouts/{config["app"]["MainPage"]}')
app = dash.Dash(__name__, use_pages=False, external_stylesheets=STYLES, external_scripts=SCRIPTS)