Advertisement
Guest User

Untitled

a guest
Nov 25th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. # settings.py
  2. STATIC_URL = '/static/'
  3. STATIC_ROOT = 'static'
  4. MEDIA_URL = '/media/'
  5. MEDIA_ROOT = 'media'
  6.  
  7. # nginx.conf
  8. location ~ ^/media/?(.*)$ {
  9. # Fallback for projects still using MEDIA_ROOT = BASE_DIR/mediafiles
  10. try_files /media/$1 /mediafiles/$1 =404;
  11. }
  12.  
  13. location ~ ^/static/?(.*)$ {
  14. # Fallback for projects still using STATIC_ROOT = BASE_DIR/staticfiles
  15. # as recommended by WhiteNoise
  16. try_files /static/$1 /staticfiles/$1 =404;
  17. add_header Cache-Control $static_cache_control;
  18. gzip_static on;
  19. gzip_types text/plain text/xml text/css text/comma-separated-values
  20. text/javascript application/x-javascript application/atom+xml;
  21. access_log off;
  22. expires 1m;
  23. sendfile off;
  24. }
  25.  
  26. # docker-compose.yml
  27.  
  28. services:
  29. nginx:
  30. image: nginx:latest
  31. restart: always
  32. volumes:
  33. - ../:/container/symplsign
  34. - ./nginx:/etc/nginx/conf.d
  35. ports:
  36. - "80:80"
  37. depends_on:
  38. - django
  39. command: /bin/bash -c '/container/symplsign/docker/run_nginx.sh'
  40. container_name: container-nginx
  41.  
  42. django:
  43. build:
  44. context: ../
  45. dockerfile: ./docker/Dockerfile
  46. restart: always
  47. working_dir: /container/symplsign
  48. volumes:
  49. - ../:/container/symplsign
  50. expose:
  51. - 2021
  52. command: /bin/bash -c '/container/symplsign/docker/run_django.sh'
  53. container_name: container-django
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement