ned2 / slapdash

Boilerplate for bootstrapping scalable multi-page Dash applications
MIT License
253 stars 31 forks source link

Documentation on Heroku Deployment #21

Closed btoro closed 5 years ago

btoro commented 5 years ago

This many not be an issue or belong here, but I was wondering if you can help in documenting how one can deploy this to Heroku

ned2 commented 5 years ago

There's instructions on deploying to Heroku on the Dash Docs.

The only change I think you need to make is to the ProcFile, which I think would become:

web: gunicorn slapdash.wsgi

Replacing slapdash with your top-level module name/project slug.

bcliang commented 5 years ago

I deployed a demo slapdash app to heroku and did so with slight revision to what was recommended in Dash Docs. I didn't actually try the above, so it might be a more straightforward way to move forward than what I ended up doing.

Here are my specific modifications:

Procfile:

web: gunicorn src.[app-name].wsgi:application

gunicorn - web server src.[app-name].wsgi - path to wsgi.py application - tells the web worker that wsgi.application is the Flask instance.

/src/[app-name]/wsgi.py (comment out app.enable_dev_tools()):

from .app import server as application
from .app import app

# When using a WSGI server or running with Flask, the dev tools need to be
# manually enabled. By default debug mode is off. To enable dev mode, set the
# environment variable `DASH_DEBUG` to `true`. You can also turn individual dev
# tools features on using this method. See https://dash.plot.ly/devtools

# app.enable_dev_tools()

Lastly, I created a file (runtime.txt) alongside Procfile to specify the heroku environment:

python-3.7.3