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