I am having issues displaying my dash app to azure web applications. I have the code deployed but when I click on the link it says the app is up and running but there is no code…Even though I have code. Here is the website
Is there something I am missing?
Here is my dash_app code:
""" Import Dash modules"""
from dash import Dash
from Callbacks import add_callbacks
from Layout import dash_layout
external_stylesheets = ["https://codepen.io/chriddyp/pen/bWLwgP.css"]
dash_app: Dash = Dash(__name__, external_stylesheets=external_stylesheets)
app = dash_app.server
dash_app.layout = dash_layout
if __name__ == "__main__":
callbacks and layout are in different modules. its a lot of code so it all cannot be in this file. Also this runs perfectly on my local machine.
It’s difficult to say, but I suspect you aren’t forwarding ports properly. When you run
dash_app.run_server(debug=True), the development server is run on port 8050 on the server. To remedy this, you could try setting in-bound rules for traffic such that in-bound traffic from port 80 (or 443 for HTTPS), is redirected to port 8050. Another option is to directly set the port argument in
run_server. In any care, both of these suggestions are not best practice.
If you actually intend to use the application for production, I would use a production server like gunicorn on your Azure server, and avoid using
run_server at all.
Id start with a basic app like the one I posted and go from there.
Make sure you also have your requirements set up to import all the dependencies for the Azure environment.
It looks like the app is up now, for information sake what was the issue @MauriD ?
the issue was the port that the correct port was not exposed. I actually didn’t figure it out my colleague did. This is what he did via azure CLI:
az webapp config appsettings set --resource-group <group-name> --name <app-name> --settings WEBSITES_PORT=8050
you can find more info here: Configure a custom container - Azure App Service | Microsoft Learn
The default port for gunicorn is 8000, the default for dash is 8050 and the default for Flask is 5000.
At least from my understanding this is the case.
Ah, yup can’t tell you the amount of times i’ve gone down the same path wondering why my app isn’t working only to find i didn’t open the security group ports. Good find!
Well I just noticed I am having some issues with the application. I think maybe it has to to with using a development port instead of production. the dropdown for ADF files is not populating when a file is uploaded…What do you think I can do to fix this? what port is used for a production environment?
I think I use all the same ports (my app doesn’t need that much security to change them) so i think its set to 8050 regardless of environment.