docker - docker 中的 Plotly dash 不加载 Assets

标签 docker plotly wsgi plotly-dash waitress

我有一个多页面 dash 应用程序,当它在本地运行时按预期工作:

waitress-serve --listen=0.0.0.0:80 web_app.wsgi:application

所以 assets 文件夹中的所有 Assets 都正确加载,图像 ar 加载了 src=app.get_asset_url('xyz.png') 并设置了 app.css.config。 serve_locallytrue,如此处所示,一切都加载 working

但是当在 docker 容器中加载相同的应用程序时, Assets 不会加载 not working因此本地 css 也不会加载。

已检查 docker 中的文件和文件夹,一切都符合预期。

我想我在某处遗漏了一些东西,但没有找到什么,关于如何让它工作的任何建议?

docker 文件

FROM python:3

RUN apt-get update && apt-get install -qq -y \
build-essential libpq-dev --no-install-recommends

ENV INSTALL_PATH /gtg_analytics-master
ENV PYTHONPATH "${PYTHONPATH}:$INSTALL_PATH/web_app"
RUN mkdir -p $INSTALL_PATH

WORKDIR $INSTALL_PATH

COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt

COPY web_app $INSTALL_PATH/web_app

docker 组成:

version: "3"

services:
web_app:
image: patber/gtg:dev
build: .
command: >
  waitress-serve --listen=0.0.0.0:80
  web_app.wsgi:application
environment:
  PYTHONUNBUFFERED: 'true'
volumes:
  - '.:/web_app'
ports:
  - '80:80'

最佳答案

找到了 CSS 文件的解决方案 here .

app.css.append_css({"external_url": "./assets/xyz.css"})

关于docker - docker 中的 Plotly dash 不加载 Assets ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54706867/

相关文章:

docker - Docker图多服务器部署

python - Plotly 中的桑基图未显示任何图形

python - Tornado vs wsgi(与 gunicorn)

linux - docker 显示 "?"上的文件权限

docker - 创建服务失败,错误代码为 "No command specified"

python - 如何在 python 中向箱形图添加标签?

r - 使用多个 geom 时如何消除 ggplotly 重复的图例条目

python - 尝试在 Apache2 上使用 WSGI 部署 Flask 时如何解决导入错误

python - 安装 Python 2.6.2 的 Ubuntu 9.04 上的 mod_wsgi 2.5

docker - docker 中的Jenkins从属无法使用JNLP4连接