Hello. I have looked at similar posts and experimented a bit and I have found myself a bit stuck trying to configure dash with mod_wsgi. Mostly I am confused about how to set up my virtual hosts (.conf) file. This is my first attempt at web hosting and I am a student, so I’m still figuring things out from scratch. By the way, I added a space before every “.com” in this post because the Dash forum does not allow me to put any ‘links’ (even though they are not links) in a forum post.
The name of my site is retirotigre. com.
My app is called test.py, it is in /var/www/retirotigre. com/:
import dash
import dash_core_components as dcc
import dash_html_components as html
app = dash.Dash()
app.layout = html.Div(children=[
html.H1(children=‘Hello Dash’),
html.Div(children=‘’’
Dash: A web application framework for Python.
‘’‘),
dcc.Graph(
id=‘example-graph’,
figure={
‘data’: [
{‘x’: [1, 2, 3], ‘y’: [4, 1, 2], ‘type’: ‘bar’, ‘name’: ‘SF’},
{‘x’: [1, 2, 3], ‘y’: [2, 4, 5], ‘type’: ‘bar’, ‘name’: u’Montréal’},
],
‘layout’: {
‘title’: ‘Dash Data Visualization’
}
}
)
])
server = app.server
if name == ‘main’:
app.run_server(debug=True)
I also have my wsgi file, myapp.wsgi. It is in /var/www/retirotigre.com/wsgi-scripts:
#!/usr/bin/env python
import sys
import logging
sys.stdout = sys.stderr
logging.basicConfig(stream=sys.stderr)
sys.path.insert(0,“/var/www/retirotigre. com/”)
from test import server as application
Then, in /etc/httpd/sites-available/retirotigre. com.conf, I have my virtual hosts setup as follows:
<VirtualHost *:80>
ServerName www.retirotigre. com
ServerAlias retirotigre. com
DocumentRoot /var/www/retirotigre. com/html
ErrorLog /var/www/retirotigre.com/log/error.log
CustomLog /var/www/retirotigre.com/log/requests.log combined
When I go to localhost/myapp, I see “Loading…” that never loads. The code compiles. In developer tools I get an error that says: ReferenceError: DashRenderer is not defined. I have searched online but this error seems rare, or at least there is not much info on it.
Thank you in advance for any suggestions you may have as to how I configure my dash application. I have tried all solutions from the other two threads on this with no luck.
-mr. berry