Skip to content

Commit

Permalink
Configure static file handling
Browse files Browse the repository at this point in the history
  • Loading branch information
laurigates committed Oct 23, 2023
1 parent 76e6da6 commit 62304da
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
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

0 comments on commit 62304da

Please sign in to comment.