我有一个多页划线应用程序,在本地运行它时按预期工作:
waitress-serve --listen = 0.0.0.0:80 web_app.wsgi:application
所以资产文件夹中的所有资产都正确加载,图像加载src=app.get_asset_url('xyz.png')
并将app.css.config.serve_locally
设置为true
,如图所示,所有加载working
但是当在docker容器中加载相同的应用程序时,资产不会加载not working,因此本地css也不会加载。
检查了docker中的文件和文件夹,一切都是预期的。
我想我在某个地方遗漏了一些但却找不到什么,有关如何让它发挥作用的任何建议?
Dockerfile
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
泊坞窗 - 撰写:
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"})