docker/production: change default static root, enable serving media by nginx

jenkins
Christian Merten 3 years ago
parent d07fa597ac
commit 069a19ec5f
Signed by: christian.merten
GPG Key ID: D953D69721B948B3

@ -8,7 +8,7 @@ RUN groupadd -g 501 app && useradd -g 501 -u 501 -m -d /app app
# create static directory and set permissions, when doing this before mounting a named volume
# in docker-compose.yaml, the permissions are inherited during the mount.
RUN mkdir -p /var/www/jdav_web/assets && chown -R app:app /var/www/jdav_web/assets
RUN mkdir -p /var/www/jdav_web/static && chown -R app:app /var/www/jdav_web/static
# create static directory and set permissions, when doing this before mounting a named volume
# in docker-compose.yaml, the permissions are inherited during the mount.

@ -19,15 +19,16 @@ services:
volumes:
- uwsgi_data:/tmp/uwsgi/
- web_static:/app/static/
- web_static:/var/www/jdav_web/assets/
- ./media:/app/media/
- web_static:/var/www/jdav_web/static/
- ./media:/var/www/jdav_web/media/
nginx:
build: ./nginx/
restart: always
volumes:
- uwsgi_data:/tmp/uwsgi/
- web_static:/var/www/jdav_web/assets/:ro
- web_static:/var/www/jdav_web/static/:ro
- ./media:/var/www/jdav_web/media/:ro
ports:
- "3000:80"
depends_on:

@ -8,7 +8,11 @@ server {
charset utf-8;
location /static {
alias /var/www/jdav_web/assets;
alias /var/www/jdav_web/static;
}
location /media {
alias /var/www/jdav_web/media;
}
location / {

@ -127,7 +127,7 @@ STATICFILES_DIRS = [
# use python3 manage.py collectstatic to collect static files in the STATIC_ROOT
# this is needed for deployment
STATIC_ROOT = os.environ.get('DJANGO_STATIC_ROOT',
'/var/www/jdav_web/assets')
'/var/www/jdav_web/static')
# Locale files (translations)

Loading…
Cancel
Save