Py.Cafe

Letshadow/

dash-mantine-multipages

Interactive Data Analysis with Dash & Mantine

DocsPricing
  • pages/
  • app.py
  • requirements.txt
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
from dash import Dash, _dash_renderer, page_container, html
import dash_mantine_components as dmc
import dash

# REQUISITO PYCAFE / DMC 2.x
_dash_renderer._set_react_version("18.2.0")

app = Dash(__name__, use_pages=True)

# Definimos el Layout con AppShell
app.layout = dmc.MantineProvider(
    children=[
        dmc.AppShell(
            [
                dmc.AppShellHeader(px="15vw",children=dmc.Text("PyCafe App", px=20), h=60),
                dmc.AppShellNavbar(
                    
                    children=[
                        # Usar el registro de páginas para obtener la ruta real de PyCafe
                        dmc.NavLink(
                            label="Inicio", 
                            href=dash.page_registry["pages.home"]["relative_path"]
                        ),
                        dmc.NavLink(
                            label="Analíticas", 
                            href=dash.page_registry["pages.analytics"]["relative_path"]
                        ),
                    ],
                ),
                dmc.AppShellMain(p="50vh",children=[page_container]),
            ],
          
        )
    ]
)

if __name__ == "__main__":
    app.run(debug=True)