Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # settings.py
- STATIC_URL = '/static/'
- STATIC_ROOT = 'static'
- MEDIA_URL = '/media/'
- MEDIA_ROOT = 'media'
- # nginx.conf
- location ~ ^/media/?(.*)$ {
- # Fallback for projects still using MEDIA_ROOT = BASE_DIR/mediafiles
- try_files /media/$1 /mediafiles/$1 =404;
- }
- location ~ ^/static/?(.*)$ {
- # Fallback for projects still using STATIC_ROOT = BASE_DIR/staticfiles
- # as recommended by WhiteNoise
- try_files /static/$1 /staticfiles/$1 =404;
- add_header Cache-Control $static_cache_control;
- gzip_static on;
- gzip_types text/plain text/xml text/css text/comma-separated-values
- text/javascript application/x-javascript application/atom+xml;
- access_log off;
- expires 1m;
- sendfile off;
- }
- # docker-compose.yml
- services:
- nginx:
- image: nginx:latest
- restart: always
- volumes:
- - ../:/container/symplsign
- - ./nginx:/etc/nginx/conf.d
- ports:
- - "80:80"
- depends_on:
- - django
- command: /bin/bash -c '/container/symplsign/docker/run_nginx.sh'
- container_name: container-nginx
- django:
- build:
- context: ../
- dockerfile: ./docker/Dockerfile
- restart: always
- working_dir: /container/symplsign
- volumes:
- - ../:/container/symplsign
- expose:
- - 2021
- command: /bin/bash -c '/container/symplsign/docker/run_django.sh'
- container_name: container-django
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement