-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.py
103 lines (88 loc) · 2.06 KB
/
index.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
from flask import Flask
server = Flask(__name__)
@server.route("/")
def hello_world():
return "Hello from test Flask!"
import sys
print(sys.version)
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
from app import app
from page import state, historic
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 == "/page/state":
return state.layout
elif pathname == "/page/about":
return historic.layout
elif pathname == "/page/wealth":
return historic.layout
else:
return state.layout
if __name__ == "__main__":
app.run_server(debug=True)
#
# ####################
#
#
# from flask import Flask
#
# server = Flask(__name__)
#
# @server.route('/')
# def hello_world():
# return 'Hello from test Flask!'
#
# import sys
# print(sys.version)
# import dash_core_components as dcc
# import dash_html_components as html
# from dash.dependencies import Input, Output
#
# from app import app, navbar
# from page import state, historic
#
#
#
# url_bar_and_content_div = html.Div([
# dcc.Location(id='url', refresh=False),
# html.Div(id='page-content')
# ])
#
# layout_index= navbar
# layout_page_1 = state.layout
# layout_page_2 = historic.layout
#
# # index layout
# app.layout = url_bar_and_content_div
#
# # "complete" layout
# app.validation_layout = html.Div([
# url_bar_and_content_div,
# layout_index,
# layout_page_1,
# layout_page_2,
# ])
#
#
#
#
# @app.callback(Output('page-content', 'children'),
# [Input('url', 'pathname')])
# def display_page(pathname):
# if pathname == '/page/state':
# return state.layout
# elif pathname == '/page/about':
# return historic.layout
# elif pathname == '/page/wealth':
# return historic.layout
# else:
# return state.layout
#
# if __name__ == '__main__':
# app.run_server(debug=True)
#