Set PYTHONPATH

This commit is contained in:
Roland Geider
2026-01-09 16:03:50 +01:00
parent 2b03ac7864
commit 1c276ed3d7
2 changed files with 13 additions and 6 deletions

View File

@@ -104,18 +104,24 @@ USER wger
WORKDIR /home/wger/src
RUN python3 -m venv /home/wger/venv
# Change permissions of some files and folders so the apache process
# can access them.
# Configure the application
ENV PYTHONPATH=/home/wger/src
ENV DJANGO_SETTINGS_MODULE=settings.main
ENV MEDIA_ROOT=/home/wger/media
ENV STATIC_ROOT=/home/wger/static
ENV DJANGO_DB_DATABASE=/home/wger/db/database.sqlite
ENV COMPRESS_OFFLINE=True
# Change permissions of some files and folders so the apache process can access them.
RUN mkdir -p ~/static/CACHE ~/media \
&& ln -s /home/wger/static/CACHE /home/wger/src/CACHE \
&& chmod g+w /home/wger/static/CACHE
RUN --mount=type=bind,from=builder,source=/wheels,target=/wheels . /home/wger/venv/bin/activate \
&& pip install --upgrade pip \
&& pip install --no-cache /wheels/* \
&& pip install -e . \
&& sed -i "/^MEDIA_ROOT/c\MEDIA_ROOT='\/home\/wger\/media'" settings/production.py \
&& echo STATIC_ROOT=\'/home/wger/static\' >> settings/production.py \
&& mkdir -p /home/wger/db \
&& . /home/wger/venv/bin/activate \
&& wger bootstrap --no-process-static \
&& python3 manage.py sync-exercises \
&& wger load-online-fixtures \

View File

@@ -79,7 +79,8 @@ ARG BUILD_DATE
ENV PATH="/home/wger/.local/bin:$PATH"
ENV APP_BUILD_COMMIT=$BUILD_COMMIT
ENV APP_BUILD_DATE=$BUILD_DATE
ENV DJANGO_SETTINGS_MODULE='settings.main'
ENV PYTHONPATH=/home/wger/src
ENV DJANGO_SETTINGS_MODULE=settings.main
WORKDIR /home/wger/src
EXPOSE 8000