Dash with gunicorn crashed

Hi ,
I tried to use dash with gunicorn.
I took the example " Using Plotly Dash" in user-guide.

/usr/local/miniconda3/bin/python3 app.py # this worked

/usr/local/miniconda3/bin/gunicorn --workers 4 --worker-class gevent --bind app:app.server
it failed:

Failed to parse ‘app.server’ as an attribute name or function call.

Do you have any idea what I am doing wrong ?

Without seeing the contents of your app.py file, we can only guess. Maybe you forgot to define the server variable (that’s at least what th error message indicates)?

In the app.py file you need to expose the server object:

server = app.server

and then use

gunicorn --workers 4 --worker-class gevent --bind app:server
1 Like

Thank you,
This solved the problem.
I followed the example In the documentation.
But the code you offered was not included.