Package: dash-manager
Dash ManagerDash Manager is an easy-to-use device that allows you to combine multiple Dash applications on a single Flask server.
A layout wrapper is also adding for each application into which common elements, such as the navigation bar, can be encoded.Simple Examplefromdash_managerimportDashManager,BaseViewfromdashimportDash,htmlmanager=DashManager(template_mode='bootstrap')# or mantine# Pagespage=Dash(name='First Dashboard')page.layout=lambda:html.Div('This is First Dashboard')page2=Dash(name='Second Dashboard',url_base_pathname='/two/')page2.layout=lambda:html.Div('This is Second Dashboard')page3=Dash(name='Third Dashboard',url_base_pathname='/three/')page3.layout=lambda:html.Div('This is Third Dashboard')# Viewsmanager.add_view(BaseView(page,category='Dropdown'))manager.add_view(BaseView(page2,category='Dropdown'))manager.add_view(BaseView(page3))# Run appmanager.run(debug=True)InstalationDash-manager is published as a Python package and can be installed with pip, ideally by using a virtual environment.
Open up a terminal and install dash-manager with:pipinstalldash-managerThis will automatically install compatible versions of all dependencies: Flask, Dash, Dash Bootstrap & Dash Mantine.
Dash manager always strives to support the latest versions, so there's no need to install those packages separately.Creating your appAfter you've installed Dash Manager, you can create a recommended application structure. Go to the directory where you want
your project to be located and enter:dash_managernew*This will create the following structure, where in each file there will be detailed descriptions:.
├─ assets/
├─ webApp/
│  └─ views
│     └─ first_dash
│        └─ __init__.py
│        └─ app.py
│     └─ second_dash
│        └─ __init__.py
│        └─ app.py
│     └─ __init__.py
│  └─ __init__.py
│  └─ config.py
│  └─ server.py
└─ wsgi.pyThe resulting project is a basic application that can be run via wsgi.py:pythonwsgi.pyProtectingDash Manager lets you define access control rules on each of your view classes by simply
overriding the is_accessible method. How you implement the logic is up to you, but if you were
to use a low-level library like Flask-Login, then restricting access could be as simple as:fromdash_managerimportBaseViewfromflaskimportredirect,url_forfromflask_loginimportcurrent_userclassMyView(BaseView):defis_accessible(self):returncurrent_userandcurrent_user.is_authenticateddefinaccessible_callback(self,name,**kwargs):# redirect to login page if user doesn't have accessreturnredirect(url_for('login',next=request.url))In the navigation menu, components that are not accessible to a particular user will not be
displayed for that user. The main drawback is that you still need to implement all of the
relevant login, registration, and account management views yourself.CustomizationYou can use three built-in themes for your application: Bootstrap, Mantine & Clear. But if you need a
completely custom interface: override dash_manager.manager.template.BaseTemplate class.classMyTemplate(BaseTemplate):defnavbar(self,menu:list,links:list):"""Override this method to create a custom navigation barMenu is list of dash_manager.manager.menu.MenuView ordash_manager.manager.menu.MenuCategory object"""...defapp_container(self,navbar,app_layout,footer):"""Override this method to create a custom container"""...deffooter(self):"""Override this method to create a custom footer"""...Read more about this hereGrouping ViewsWhen adding a view, specify a value for the category parameter to group related views together in the menu:manager.add_view(BaseView(page,category='Dropdown'))manager.add_view(BaseView(page2,category='Dropdown'))This will create a top-level menu item named ‘Dropdown’, and a drop-down containing links to the two views.And to add arbitrary buttons to the menu:btn=dmc.Anchor(dmc.ActionIcon(DashIconify(icon='radix-icons:avatar',width=22),variant="outline",radius='md',size=36,color='indigo',),href='/profile',refresh=True)manager.add_link(btn)