fix(deploy): serve django media and static from shared volumes
This commit is contained in:
@@ -30,8 +30,8 @@ services:
|
|||||||
env_file:
|
env_file:
|
||||||
- ./backend/qlockify-backend-deployment/.env
|
- ./backend/qlockify-backend-deployment/.env
|
||||||
volumes:
|
volumes:
|
||||||
- static_data:/app/staticfiles
|
- static_data:/app/static
|
||||||
- media_data:/app/mediafiles
|
- media_data:/app/media
|
||||||
command: >
|
command: >
|
||||||
sh -c "python manage.py migrate &&
|
sh -c "python manage.py migrate &&
|
||||||
python manage.py collectstatic --noinput &&
|
python manage.py collectstatic --noinput &&
|
||||||
@@ -52,7 +52,7 @@ services:
|
|||||||
env_file:
|
env_file:
|
||||||
- ./backend/qlockify-backend-deployment/.env
|
- ./backend/qlockify-backend-deployment/.env
|
||||||
volumes:
|
volumes:
|
||||||
- media_data:/app/mediafiles
|
- media_data:/app/media
|
||||||
command: celery -A config worker -l INFO
|
command: celery -A config worker -l INFO
|
||||||
depends_on:
|
depends_on:
|
||||||
db:
|
db:
|
||||||
@@ -82,8 +82,8 @@ services:
|
|||||||
- ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf:ro
|
- ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf:ro
|
||||||
- ./nginx/certs:/etc/nginx/certs:ro
|
- ./nginx/certs:/etc/nginx/certs:ro
|
||||||
- ./nginx/.htpasswd:/etc/nginx/.htpasswd:ro
|
- ./nginx/.htpasswd:/etc/nginx/.htpasswd:ro
|
||||||
- static_data:/usr/share/nginx/html/staticfiles:ro
|
- static_data:/usr/share/nginx/html/static:ro
|
||||||
- media_data:/usr/share/nginx/html/mediafiles:ro
|
- media_data:/usr/share/nginx/html/media:ro
|
||||||
depends_on:
|
depends_on:
|
||||||
- backend
|
- backend
|
||||||
- frontend
|
- frontend
|
||||||
|
|||||||
@@ -37,13 +37,13 @@ server {
|
|||||||
|
|
||||||
# Static and Media files
|
# Static and Media files
|
||||||
location /static/ {
|
location /static/ {
|
||||||
alias /usr/share/nginx/html/staticfiles/;
|
alias /usr/share/nginx/html/static/;
|
||||||
expires 30d;
|
expires 30d;
|
||||||
access_log off;
|
access_log off;
|
||||||
}
|
}
|
||||||
|
|
||||||
location /media/ {
|
location /media/ {
|
||||||
alias /usr/share/nginx/html/mediafiles/;
|
alias /usr/share/nginx/html/media/;
|
||||||
expires 30d;
|
expires 30d;
|
||||||
access_log off;
|
access_log off;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user