I am trying to figure out how to organise a dash project with multiple apps. All examples are single page apps and I want to have multiple dashes organised as one project to run by gunicorn (inside a docker container):
dash-project/
app1/
layout.py
data.py
app2/
layout.py
data.py
run.py( or run.sh)
Is this a right way to go? What should be inside run.py
or run.sh
, if anything? How do I use gunicorn to serve multiple apps?
With latest (master) version of dash, you can build a multi-app project!
Structure
dash-project/
app1/
app.py
datamodel.py
app2/
app.py
datamodel.py
mycomponents/
...
server.py
run.py
app1/app.py:
import dash
import app1.datamodel
..
from server import server
app = dash.Dash(name='app1', sharing=True,
server=server, url_base_pathname='/app1')
server.py
from flask import Flask
server = Flask(__name__)
run.py
from server import server as application
import app1.app
import app2.app
Serve using uwsgi (can be easily exended to be used with nginx)
uwsgi --http 0.0.0.0:5000 --processes 4 --wsgi-file run.py
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With