Add media files config

This commit is contained in:
PCoder 2022-09-19 13:35:02 +05:30
parent 3eb5ba12d9
commit 0123fd2eef
3 changed files with 10 additions and 0 deletions

View file

@ -45,6 +45,7 @@ ENV HOME=/home/app
ENV APP_HOME=/home/app/app ENV APP_HOME=/home/app/app
RUN mkdir $APP_HOME RUN mkdir $APP_HOME
RUN mkdir $APP_HOME/static RUN mkdir $APP_HOME/static
RUN mkdir $APP_HOME/media
WORKDIR $APP_HOME WORKDIR $APP_HOME
# install dependencies # install dependencies

View file

@ -8,6 +8,7 @@ services:
command: gunicorn gmba_django.wsgi:application --bind 0.0.0.0:8000 command: gunicorn gmba_django.wsgi:application --bind 0.0.0.0:8000
volumes: volumes:
- static_volume:/home/app/app/static - static_volume:/home/app/app/static
- media_volume:/home/app/app/media
expose: expose:
- 8000 - 8000
env_file: env_file:
@ -24,6 +25,7 @@ services:
build: ./nginx build: ./nginx
volumes: volumes:
- static_volume:/home/app/app/static - static_volume:/home/app/app/static
- media_volume:/home/app/app/media
ports: ports:
- 1337:80 - 1337:80
depends_on: depends_on:
@ -32,3 +34,4 @@ services:
volumes: volumes:
postgres_data: postgres_data:
static_volume: static_volume:
media_volume:

View file

@ -16,6 +16,12 @@ server {
location /static/ { location /static/ {
alias /home/app/app/static/; alias /home/app/app/static/;
expires max;
}
location /media/ {
alias /home/app/app/media/;
expires max;
} }
add_header Content-Security-Policy "frame-ancestors https://www.gmba.unibe.ch" add_header Content-Security-Policy "frame-ancestors https://www.gmba.unibe.ch"