Skip to content

Remove server=app.server requirement for Gunicorn #3131

@ndrezn

Description

@ndrezn

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 .

Metadata

Metadata

Assignees

Labels

P1needed for current cyclefeaturesomething new

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions