-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.py
57 lines (43 loc) · 1.45 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
#-*- coding: utf-8 -*-
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
from __init__ import *
from index import index_page
from delitos_estatales_vieja import layout as vde
from delitos_estatales_vieja import submenu as sub_vde
from delitos_fuero_comun import layout as dfc
from delitos_fuero_comun import submenu as sub_dfc
from delitos_federales import layout as df
from delitos_federales import submenu as sub_df
from socioeconomico import layout as layout_social
from socioeconomico import submenu as sub_social
from sidebar import sidebar
CONTENT_STYLE = {
"margin-left": "18rem",
"margin-right": "2rem",
"padding": "2rem 1rem",
}
app.layout = html.Div([
sidebar,
dcc.Location(id='url', refresh=False),
html.Div(id='page-content', style=CONTENT_STYLE)
])
# Esta funcion sirve para hacer el routing de la aplicación
@app.callback(
[Output('page-content', 'children'),
Output('custom-nav', 'children')],
[Input('url', 'pathname')])
def display_page(pathname):
if pathname == '/delitos-estatales-vieja':
return [vde, sub_vde]
elif pathname == '/fuero-comun':
return [dfc, sub_dfc]
elif pathname == '/delitos-federales':
return [df, sub_df]
elif pathname == '/socioeconomico':
return [layout_social, sub_social]
else:
return [index_page, None]
if __name__ == "__main__":
app.run_server(debug=True)