There’s a weird issue with Dash using Gunicorn+SupervisorCTL
I’m runing a hybrid Flask+FlaskRestful with Gunicorn and SupervisorCTL and I just added Dash to it.
My structure is:
main.py (where Flask is created, passed to Flask Restful, SqlAlchemy and now Dash) index.py (where dash loads its layout - the entry point - imports app from main.py)
In index.py I have the following:
from main import app # ... app.layout = layout # ... @app.callback(blablabla) # ... server = app.server if __name__ == '__main__': app.run_server(port=8000)
Now, when I get into venv with the correct user and I do
gunicorn index:server, it works perfectly.
But when I use supervisorctl to do it, it doesn’t work!
Here’s how it looks in supervisor:
command = /opt/myapp/run.sh gunicorn -c /etc/gunicorn.conf.py index:server
Where run.sh starts the .venv
I tried doing index:app.server but everytime I get:
Application object must be callable.
While this does not happen when I call the command directly.