mirror of
https://github.com/thecyberlearn/modern-django-starter.git
synced 2026-08-18 07:52:54 +00:00
Fix database configuration for simplified Dokploy setup
- Add docker-compose.dokploy-external-db.yml that matches quantum-digital exactly - Uses external DATABASE_URL only (no db container) - Fix docker-compose.dokploy-simple.yml to include database container with proper networking Choose one approach: - dokploy-external-db.yml: Use with external database (Neon, Supabase, etc.) - dokploy-simple.yml: Use with Docker PostgreSQL container The error 'could not translate host name db' is fixed in both versions.
This commit is contained in:
parent
6185c25776
commit
1046a3b05c
21
docker-compose.dokploy-external-db.yml
Normal file
21
docker-compose.dokploy-external-db.yml
Normal file
@ -0,0 +1,21 @@
|
||||
services:
|
||||
web:
|
||||
build: .
|
||||
ports:
|
||||
- "8000:8000"
|
||||
environment:
|
||||
- DEBUG=False
|
||||
- ALLOWED_HOSTS=dt.netcoptech.com,localhost,127.0.0.1
|
||||
- DATABASE_URL=${DATABASE_URL}
|
||||
- SECRET_KEY=${SECRET_KEY}
|
||||
- DJANGO_SETTINGS_MODULE=django_project.settings.production
|
||||
- CSRF_TRUSTED_ORIGINS=https://dt.netcoptech.com
|
||||
- SECURE_SSL_REDIRECT=True
|
||||
- GOOGLE_OAUTH2_CLIENT_ID=${GOOGLE_OAUTH2_CLIENT_ID:-demo-google-client-id}
|
||||
- GOOGLE_OAUTH2_CLIENT_SECRET=${GOOGLE_OAUTH2_CLIENT_SECRET:-demo-google-client-secret}
|
||||
command: >
|
||||
sh -c "python manage.py migrate &&
|
||||
python manage.py create_groups &&
|
||||
python manage.py setup_social_apps &&
|
||||
python manage.py collectstatic --noinput &&
|
||||
gunicorn --bind 0.0.0.0:8000 --workers 3 --timeout 120 django_project.wsgi:application"
|
||||
@ -6,13 +6,35 @@ services:
|
||||
environment:
|
||||
- DEBUG=False
|
||||
- ALLOWED_HOSTS=dt.netcoptech.com,localhost,127.0.0.1
|
||||
- DATABASE_URL=${DATABASE_URL}
|
||||
- SECRET_KEY=${SECRET_KEY}
|
||||
- DATABASE_URL=${DATABASE_URL:-postgresql://django_user:django_password@db:5432/django_db}
|
||||
- SECRET_KEY=${SECRET_KEY:-django-insecure-change-this-key}
|
||||
- DJANGO_SETTINGS_MODULE=django_project.settings.production
|
||||
- CSRF_TRUSTED_ORIGINS=https://dt.netcoptech.com
|
||||
- SECURE_SSL_REDIRECT=True
|
||||
- GOOGLE_OAUTH2_CLIENT_ID=${GOOGLE_OAUTH2_CLIENT_ID:-demo-google-client-id}
|
||||
- GOOGLE_OAUTH2_CLIENT_SECRET=${GOOGLE_OAUTH2_CLIENT_SECRET:-demo-google-client-secret}
|
||||
depends_on:
|
||||
- db
|
||||
networks:
|
||||
- dokploy-network
|
||||
|
||||
db:
|
||||
image: postgres:15-alpine
|
||||
environment:
|
||||
- POSTGRES_DB=django_db
|
||||
- POSTGRES_USER=django_user
|
||||
- POSTGRES_PASSWORD=django_password
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data/
|
||||
networks:
|
||||
- dokploy-network
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
|
||||
networks:
|
||||
dokploy-network:
|
||||
external: true
|
||||
command: >
|
||||
sh -c "python manage.py migrate &&
|
||||
python manage.py create_groups &&
|
||||
|
||||
Loading…
Reference in New Issue
Block a user