Hello,
I currently have a flask app and I want to implement a dash app into it. However I’ve been running into multiple errors and I don’t really understand the document for dash deployment. Here is my code
flaskapp.py
server = Flask(__name__)
@server.route('/dash')
def dash_chart():
dashapp.start()
if __name__ == "__main__":
server.run(debug=True)
I do not use routes so I do not understand your question…
If I need to grab data or scripts/functions from other folders I handle everything in Python. What I mean is say I need to grab some data from a file to plot I will do something like:
import pandas
with open('path/name_of_file.txt', 'r' as input_file):
data = pandas.dataframe(input_file) #not correct syntax, but I hope you get the gesture of it
import plotly
'Do fancy stuff with my data using plotly and make an awesome plot'
import dash
'launch app and put in awesome plot'
Sorry I do not understand, but I hope this somehow helps.
This probably isn’t working for the reason you think it is. The first call to run_server will block as you’ve now got a web server listening for incoming requests. So the second run_server won’t be executed.
Oh, I see I have made a typo (sorry)
The first line was some leftover code (which is usually outcommented) from before I started hosting my app through waitress.
It should just be
if __name__ == '__main__':
app.run_server(debug=True)