My question now is when running the dash app in flask, what do I need to write at the top. Do i have to put a url at the top. of the app. I had written the following
from flask import Flask
application=Flask(_name_)
@app.route("/scipt_name")
app = dash.Dash(__name__, server=server)
but it kept on returning the same error of not displaying. What could be the possible error given that we deployed a hello script and it worked
This is more of a deployment/hosting question regarding hosting Flask apps than a Dash specific one (all Dash apps use Flask). It really depends on how you’re serving the WSGI app. You mentioned that you’re using Apache, is this using mod_wsgi?
However you’re serving it, it’s unlikely you’ll be entering a .py extension into the URL. Unless you explicitly need to host multiple Dash apps alongside each other, you don’t need to use the DispatcherMiddleware from that post.
A simple way to get a Dash app deployed using the Gunicorn WSGI server assuming you have an app.py file with a Dash instance in an ‘app’ variable:
While lauching gunicorn like this makes the app accessible from port 5000, how do I make sure that any other app is accessible via the default browser port (port 80) without invoking gunicorn manually as above.
If you want make your Dash app publicly available on port 80, you probably want to use an HTTP proxy server to proxy incoming request to Gunicorn. The Gunicorn docs recommend nginx: http://docs.gunicorn.org/en/stable/deploy.html
If you’re running it on a server that’s always on, then you only need to start gunicorn once. You could also create a service of some kind that runs your gunicorn script at startup if needed. You should be able to find lots of guides to achieving these things online, as this is now a general question about hosting a Flask app with gunicorn and not Dash specific.