Zappa
Zappa copied to clipboard
Work with Plotly Dash devs to doc Zappa deploy
x-posted with Dash here
Context
There's been an lingering issue with using Dash and Zappa producing 403, 404, and 500 errors, depending upon how the app file and Zappa JSON settings are written. It's difficult to deploy a Dash app with Zappa -- a major bummer, since the combination of Dash's slickness with Zappa's serverlessness is a killer peanut-butter-and-chocolate combo.
Expected Behavior
I'd like a "Hello World" doc for a serverless Dash app using Zappa OR a Dash-side OR Zappa-side patch to address behavior. Currently using latest for each, zappa 0.54.1 and Dash 2.0.0 in Python 3.8.
Actual Behavior
I've followed closely the mods discussed here and the sample app but am still hitting errors. Tried the mod here and am still getting a 404.
Here's the three different file configs I've tried:
-
Dash object as app_function If I use this config, a visit to the app URL results in a 500 error
Dash object is not callable
, as discussed. Tinkering with the Dash object doesn't address this. -
Flask server as app_function This suggestion results in a 403 when visiting the app URL.
-
Same as 2, plus url_base_pathname. Results in a 404.
Possible Fix
n/a
Steps to Reproduce
Details in ticket x-posted in Dash project
Your Environment
- Zappa version used:
- Operating System and Python version: Ubuntu 20.2, Python 3.8
- The output of
pip freeze
:
appdirs==1.4.3
argcomplete==1.12.3
boto3==1.20.5
botocore==1.23.5
Brotli==1.0.9
CacheControl==0.12.6
certifi==2019.11.28
cfn-flip==1.3.0
chardet==3.0.4
click==8.0.3
colorama==0.4.3
contextlib2==0.6.0
dash==2.0.0
dash-bootstrap-components==1.0.0
dash-core-components==2.0.0
dash-html-components==2.0.0
dash-table==5.0.0
distlib==0.3.0
distro==1.4.0
durationpy==0.5
Flask==2.0.2
Flask-Compress==1.10.1
future==0.18.2
hjson==3.0.2
html5lib==1.0.1
idna==2.8
ipaddr==2.2.0
itsdangerous==2.0.1
Jinja2==3.0.3
jmespath==0.10.0
kappa==0.6.0
lockfile==0.12.2
MarkupSafe==2.0.1
msgpack==0.6.2
packaging==20.3
pep517==0.8.2
pip-tools==6.4.0
placebo==0.10.0
plotly==5.3.1
progress==1.5
pyparsing==2.4.6
python-dateutil==2.8.2
python-slugify==5.0.2
pytoml==0.1.21
PyYAML==6.0
requests==2.22.0
retrying==1.3.3
s3transfer==0.5.0
six==1.14.0
tenacity==8.0.1
text-unidecode==1.3
toml==0.10.2
tqdm==4.62.3
troposphere==3.1.1
urllib3==1.25.8
webencodings==0.5.1
Werkzeug==2.0.2
wsgi-request-logger==0.4.6
zappa==0.54.1
- Link to your project (optional):
- Your
zappa_settings.json
: Actually I have a couple, see details here.
Here is my hello world example main.py
:
import dash
from dash import html
dapp = dash.Dash(__name__)
dapp.layout = html.Div(
id="parent",
children=[
html.H1(
id="H1",
children="Styling using html components",
style={"textAlign": "center", "marginTop": 40, "marginBottom": 40},
)
],
)
app = dapp.server.wsgi_app
if __name__ == "__main__":
dapp.run_server()
With zappa_settings.json
{
"dev": {
"app_function": "main.app",
"aws_region": "eu-central-1",
"profile_name": "default",
"project_name": "pythonproject",
"runtime": "python3.8",
"environment_variables": {"DASH_REQUESTS_PATHNAME_PREFIX": "/dev/"}
}
}
Hi there! Unfortunately, this Issue has not seen any activity for at least 90 days. If the Issue is still relevant to the latest version of Zappa, please comment within the next 10 days if you wish to keep it open. Otherwise, it will be automatically closed.
Hi there! Unfortunately, this Issue was automatically closed as it had not seen any activity in at least 100 days. If the Issue is still relevant to the latest version of Zappa, please open a new Issue.