File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11venv /
22.env
33.dockerenv
4+ staticfiles /
Original file line number Diff line number Diff line change @@ -19,13 +19,29 @@ services:
1919 command : gunicorn task_manager.wsgi:application --bind 0.0.0.0:8000
2020 volumes :
2121 - .:/app
22+ - ./staticfiles:/app/staticfiles
2223 ports :
2324 - " 8000:8000"
2425 env_file :
2526 - .dockerenv
2627 depends_on :
2728 - db
2829
30+ nginx :
31+ image : nginx:stable-alpine
32+ container_name : nginx-proxy
33+ restart : always
34+ ports :
35+ - ' 80:80'
36+ - ' 443:443'
37+ volumes :
38+ - ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
39+ - ./nginx/sites:/etc/nginx/conf.d:ro
40+ - ./staticfiles:/app/staticfiles:ro
41+ depends_on :
42+ - web
43+
44+
2945volumes :
3046 mysql_data :
3147
Original file line number Diff line number Diff line change 1+ user nginx;
2+ worker_processes auto;
3+ error_log /var/log/nginx/error.log warn;
4+ pid /var/run/nginx.pid ;
5+
6+ events {
7+ worker_connections 1024 ;
8+ }
9+
10+ http {
11+ include /etc/nginx/mime.types ;
12+ default_type application/octet-stream ;
13+
14+ sendfile on;
15+ tcp_nopush on;
16+ tcp_nodelay on;
17+ keepalive_timeout 65 ;
18+ types_hash_max_size 2048 ;
19+
20+ include /etc/ngninx/conf.d/*.conf;
21+
22+ }
23+
Original file line number Diff line number Diff line change 1+ server {
2+ listen 80;
3+ server_name _;
4+
5+ location /static/ {
6+ alias /app/staticfiles/;
7+ expires 7d;
8+ add_header Cache-Control "public";
9+ access_log off;
10+ }
11+
12+ location / {
13+ proxy_set_header Host $host;
14+ proxy_set_header X-Real-IP $remote_addr;
15+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
16+ proxy_set_header X-Forwarded-Proto $scheme;
17+
18+ proxy_connect_timeout 10s;
19+ proxy_read_timeout 120s;
20+ proxy_send_timeout 120s;
21+
22+ proxy_pass http://web:8000;
23+ }
24+
25+ error_log /var/log/nginx/error.log;
26+ access_log /var/log/nginx/access.log;
27+
28+ }
29+
30+
31+
Original file line number Diff line number Diff line change 3333# SECURITY WARNING: don't run with debug turned on in production!
3434DEBUG = os .getenv ('DEBUG' ) == 'True'
3535
36- ALLOWED_HOSTS = ['* ' ]
36+ ALLOWED_HOSTS = ['localhost' , '127.0.0.1' , '[::1] ' ]
3737
3838
3939# Application definition
133133# Static files (CSS, JavaScript, Images)
134134# https://docs.djangoproject.com/en/5.2/howto/static-files/
135135
136+ STATIC_ROOT = '/app/staticfiles'
136137STATIC_URL = 'static/'
137138
138139# Default primary key field type
You can’t perform that action at this time.
0 commit comments