Deploying Dash app on DigitalOcean + Nginx + Ubuntu 20

I’ve been following the outline of tutorial on digitalocean How To Serve Flask Applications with Gunicorn and Nginx on Ubuntu | DigitalOcean on deploying a flask app on nginx / ubuntu, and trying to deploy a Dash app.

When trying the command gunicorn --bind 0.0.0.0:5000 wsgi:app I get the error: Application object must be callable

The way I am invoking the app is:

wsgi.py

from __init__ import app

if __name__ == "__main__":
    app.run_server()

and:

__init__.py

#code

if __name__ == '__main__':
    app.run_server(port=5000,host='0.0.0.0',debug=True)

The app itself is declared in app.py (following the multi page template from the Dash tutorial)

app.py

import dash

app = dash.Dash(__name__, suppress_callback_exceptions=True)
server = app.server

I suspect the gunicorn command needs to be modified to refer to server instead of just wsgi:app but am unsure what the right format is

When I run the app using python3 wsgi.py it runs on localhost on the VPS, but I cannot see it on the IP address of the server at ip:5000 (I guess it has to be specifically fired up using gunicorn)

1 Like