Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure static file handling #49

Merged
merged 1 commit into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ ENV DJANGO_DB_HOST=db
ENV DJANGO_DB_PORT=5432

# Device registry config
ENV MEDIA_ROOT=/media
ENV DJANGO_SETTINGS_MODULE=deviceregistry.settings
ENV MEDIA_ROOT=/media
ENV STATIC_ROOT=/static

COPY entrypoint.sh /

Expand All @@ -44,6 +45,8 @@ COPY --chown=app:app mittaridatapumppu-deviceregistry/ .
RUN chgrp -R 0 /home/app && \
chmod -R g+rwX /home/app

RUN python manage.py collectstatic --noinput

USER app

ENTRYPOINT ["/entrypoint.sh"]
Expand Down
3 changes: 2 additions & 1 deletion mittaridatapumppu-deviceregistry/deviceregistry/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.2/howto/static-files/

STATIC_URL = "static/"
STATIC_ROOT = env("STATIC_ROOT", default="/static")
STATIC_URL = env("STATIC_URL", default="/static/")

# Default primary key field type
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field
Expand Down