I want to deploy my dash product on my webfaction server. I followed the tutorial suggest me to delpoy a falsk app. I’ve successfully done that. The index.py is
import os
import sys
CURRENT_FILE = os.path.abspath(__file__)
CURRENT_DIR = os.path.dirname(CURRENT_FILE)
PROJECT_DIR = os.path.dirname(CURRENT_DIR)
# Add project top-dir to path (since it has no __init__.py)
sys.path.append(PROJECT_DIR + '/src/')
# Add virtualenv to path
sys.path.append(PROJECT_DIR + '/virtualenv/lib/python3.7/site-packages/')
# Export the Flask app object from the project as wsgi application object
from myapp0 import server as application
the myapp0.py is
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
if __name__ == "__main__":
app.run()
It works fine but and I change the flask hello world test content to dash test content in the tutorial. To deal with the errors, I add
app.scripts.config.serve_locally=True
my new myapp0.py is
import os
import dash
import dash_core_components as dcc
import dash_html_components as html
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = dash.Dash(__name__, external_stylesheets=external_stylesheets,app.scripts.config.serve_locally=True)
server = app.server
app.layout = html.Div([
html.H2('Hello World'),
dcc.Dropdown(
id='dropdown',
options=[{'label': i, 'value': i} for i in ['LA', 'NYC', 'MTL']],
value='LA'
),
html.Div(id='display-value')
])
@app.callback(dash.dependencies.Output('display-value', 'children'),
[dash.dependencies.Input('dropdown', 'value')])
def display_value(value):
return 'You have selected "{}"'.format(value)
if __name__ == '__main__':
app.run_server(debug=True)
this test code comes from tutorial on dash websitehttps://dash.plot.ly/deployment
I change the content of the file, such as making
html.H2('Hello World'),
into
html.H2('Hello World asd'),
but it does’t work. I delete cache, and change a browser, but things don’t change neither.
Could anyone please help? Thank you so much.