shshin
November 13, 2021, 1:06pm
1
Hello everyone,
I have a simple one pager dashboard which has been done with Dash plotly.
everything is working fine on localhost.
it seems there are no intuitive resources for deploying dash app via Docker.
the only useful link that I have seen in the forum is [this ] (Deployment on Docker ) link which is outdated and uses dash 1.
any helps is much appreciated.
thanks
Hi,
Which error are you having?
1 Like
tphil10
November 13, 2021, 2:18pm
3
I’m no expert in this but this is how i have mine setup in docker.
Dockerfile
FROM ubuntu:latest
WORKDIR /app
COPY . /app
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHON UNBUFFERED 1
RUN apt-get update \
&& apt-get upgrade -y python3-pip \
&& apt-get install -y python3.8 wget curl \
&& pip3 install -r requirements.txt \
&& apt autoremove -y
EXPOSE 8050
ENTRYPOINT [ "gunicorn", "--config", "gunicorn_config.py", "index:server" ]
gunicorn_config.py
bind = "0.0.0.0:8050"
workers = 3
timeout = 120
app.py
from dash import dash
import dash_bootstrap_components as dbc
app = dash.Dash(__name__,
external_stylesheets=[dbc.themes.BOOTSTRAP],
suppress_callback_exceptions=True)
My index.py file has a server = app.server
reference in it.
Hope this helps!
2 Likes
shshin
November 13, 2021, 2:45pm
4
actually I got the error of Halt gunicorn.
But with different methods I got different errors.
tphil10
November 13, 2021, 2:51pm
6
@shshin It’s a flat structure
frontend/
Dockerfile
gunicorn_config.py
index.py
app.py
2 Likes
shshin
November 13, 2021, 2:59pm
7
@tphil10 thank you so much.
I will try it out and update you about the results.
shshin
November 13, 2021, 5:07pm
8
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-2enikstv/Jinja/setup.py'"'"'; __file__='"'"'/tmp/pip-install-2enikstv/Jinja/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-2enikstv/Jinja/pip-egg-info
cwd: /tmp/pip-install-2enikstv/Jinja/
Complete output (6 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-2enikstv/Jinja/setup.py", line 28
except DistutilsError, e:
^
SyntaxError: invalid syntax
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
get error when installing the jinja
ps. I am want to deploy on Raspberry pi.
tphil10
November 14, 2021, 2:01am
9
python, django, jinja2
@shshin I dont know anything about jinja, i’d prob start here.