adding caddy to the project

This commit is contained in:
=
2025-12-30 23:41:52 +03:30
parent a6f1cdbd14
commit 3bd589a0a1
3 changed files with 22 additions and 2 deletions

3
Caddyfile Normal file
View File

@@ -0,0 +1,3 @@
api.ghaemghh.ir{
reverse_proxy django-web:8000
}

View File

@@ -11,10 +11,21 @@ services:
- postgres_data:/var/lib/postgresql/data
env_file:
- .env
caddy:
image: caddy:2
container_name: caddy
ports:
- "80:80"
- "443:443"
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile
- caddy_data:/data
- caddy_config:/config
depends_on:
- django-web
django-web:
build: .
container_name: django-docker
container_name: django-web
ports:
- "8000:8000"
depends_on:
@@ -34,3 +45,5 @@ services:
- .env
volumes:
postgres_data:
caddy_data:
caddy_config:

View File

@@ -90,6 +90,10 @@ WSGI_APPLICATION = "settings.wsgi.application"
# 'NAME': BASE_DIR / 'db.sqlite3',
# }
# }
USE_X_FORWARDED_HOST = True
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql",