Hi, Im having some trouble deploying my app to the cloud. Code works locally however when clicking on link to open the dash app within the website it fails. The error log gives a 500 error. I have tried some of the WSGI options in other topics but none have been able to work. I am assuming its to do with the WSGI file settings.
Hi @jinnyzor, the apps run well locally, it is in the deployment that Iām battling with.
I subsequently tried to launch via heroku which provided some more insight. The csv files were not being imported. I have resolved that issue and now have a new one, naturally.
The error log provides
File ā/home/TheBoatShed/.virtualenvs/myenv/lib/python3.9/site-packages/flask/app.pyā, line 792, in debug
return self.config[āDEBUGā]
KeyError: 'DEBUG
Since āDEBUGā is set in the settings.py file I donāt know how to set the variable for the flask app separately.
I have tried to add this manually in the files but has had no effect. the flask documentation suggests this is likely anyway so not surprised.
@delsim do you have any ideas as to how I can resolve this issue?
You should be able to set the config for server[āDEBUGā] by exposing the flask server in your app. Or just use app.server[āDEBUGā] and set it to something.
Its strange that you are encountering another issue.
Iāve tried the following options which havenāt worked. Did you have something else in mind in your suggestion above?
In my dash apps
dash1.py
import dash_bootstrap_components as dbc
from django_plotly_dash import DjangoDash
import pandas as pd
import plotly.express as px
from dash import dcc, html
import dash
from dash import Input, Output
from dash_bootstrap_templates import load_figure_template
load_figure_template("superhero")
from pathlib import Path
THIS_FOLDER = Path(__file__).parent.resolve()
app = DjangoDash('demo1',external_stylesheets=[dbc.themes.SUPERHERO])
#test for deployment
app.config['DEBUG']=False
DjangoDash doesnāt have a config option so this failed
I then tried
from flask import Flask
app1 = Flask(__name__)
app1.config['DEBUG']=False
Also, wanted to check with you and see if on your admin side of things it shows these dash apps in stateless apps or under dash apps? This is what my Django admin portal looks like in relation to dash. 516 stateless apps and 0 dash apps as Iām hosting dash on its own server.
I have another webapp that runs Dash pages successfully. It pulls data from csv files and displays the graphs I need. I do like the simplicity of that solution in general and could use it in this instance within the demo site.
I am looking to build a website that supports different users (coaches & athletes) accessing different levels of data. Hence why I am trying to integrate Django & Dash through Django-Plotly-Dash.
Thank you for the video suggestion I have watched that previously and where most of my specific code for the Django-dash elements have come from. I will go through it again to check if I have gone off somewhere.
From your comment above do you see my issue lying with Django or potentially with the setup in python anywhere? And will your recommended setup of separate servers work if I then need to pull data from the database?
@brendon this could just be incompatible versions of python packages. Are you able to see what versions are in use? If you are not explicitly fixing package versions it is not uncommon to find inconsistencies when publishing to a second platform.