Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Remove server=app.server requirement for Gunicorn #3131

Open
ndrezn opened this issue Jan 23, 2025 · 0 comments
Open

Remove server=app.server requirement for Gunicorn #3131

ndrezn opened this issue Jan 23, 2025 · 0 comments
Assignees
Labels
feature something new P1 needed for current cycle

Comments

@ndrezn
Copy link
Member

ndrezn commented Jan 23, 2025

Our usual recommendation for deployment is gunicorn as the production server, and you set up a Procfile or similar with:

gunicorn app:server --workers 4

But wait... what's server? Well, you need to add another line to your app.py (that's the module app referred to before the colon):

app = Dash()

...

server = app.server

Ugh, a code change! Ripe for problems. Instead we could add a method to Dash, e.g. wsgi_app which returns the flask app, and this way the Procfile can be written as:

gunicorn app:app --workers 4

And the app object already in your Dash app is picked up. Simpler, one fewer code change. nice. Vizro does this: https://vizro.readthedocs.io/en/stable/pages/user-guides/run/#jupyter .

@gvwilson gvwilson added feature something new P1 needed for current cycle labels Jan 23, 2025
@gvwilson gvwilson changed the title [Feature Request] Remove server=app.server requirement for Gunicorn Remove server=app.server requirement for Gunicorn Jan 23, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
feature something new P1 needed for current cycle
Projects
None yet
Development

No branches or pull requests

3 participants