mirror of
https://github.com/thecyberlearn/quantumtaskai-caprover.git
synced 2026-08-18 07:52:55 +00:00
Fix database configuration and add actual domain
- Add quamtumtaskai.netcoptech.com to ALLOWED_HOSTS and CSRF_TRUSTED_ORIGINS - Fix database configuration to fallback to SQLite when no PostgreSQL DATABASE_URL provided - This should resolve the 502 Bad Gateway error caused by database connection failures
This commit is contained in:
parent
5b4bc80b03
commit
2bd49184a9
@ -14,10 +14,10 @@
|
||||
"PYTHONUNBUFFERED": "1",
|
||||
"DEBUG": "false",
|
||||
"SECRET_KEY": "production-key-change-this-123456789",
|
||||
"ALLOWED_HOSTS": "*",
|
||||
"ALLOWED_HOSTS": "quamtumtaskai.netcoptech.com,website-quantumtaskai-wrczik-cc50ac-31-97-62-205.traefik.me,*",
|
||||
"DOKPLOY_PROJECT_NAME": "quantum-tasks-ai",
|
||||
"SECURE_SSL_REDIRECT": "false",
|
||||
"SECURE_PROXY_SSL_HEADER": "HTTP_X_FORWARDED_PROTO,https",
|
||||
"CSRF_TRUSTED_ORIGINS": "https://website-quantumtaskai-wrczik-cc50ac-31-97-62-205.traefik.me,http://website-quantumtaskai-wrczik-cc50ac-31-97-62-205.traefik.me"
|
||||
"CSRF_TRUSTED_ORIGINS": "https://quamtumtaskai.netcoptech.com,http://quamtumtaskai.netcoptech.com,https://website-quantumtaskai-wrczik-cc50ac-31-97-62-205.traefik.me,http://website-quantumtaskai-wrczik-cc50ac-31-97-62-205.traefik.me"
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,17 +15,22 @@ if allowed_hosts_str:
|
||||
else:
|
||||
ALLOWED_HOSTS = []
|
||||
|
||||
# Database
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.postgresql',
|
||||
'NAME': os.environ.get('DB_NAME'),
|
||||
'USER': os.environ.get('DB_USER'),
|
||||
'PASSWORD': os.environ.get('DB_PASSWORD'),
|
||||
'HOST': os.environ.get('DB_HOST', 'localhost'),
|
||||
'PORT': os.environ.get('DB_PORT', '5432'),
|
||||
# Database - use PostgreSQL if DATABASE_URL is provided, otherwise SQLite
|
||||
DATABASE_URL = os.environ.get('DATABASE_URL')
|
||||
if DATABASE_URL:
|
||||
# Parse DATABASE_URL for PostgreSQL
|
||||
import dj_database_url
|
||||
DATABASES = {
|
||||
'default': dj_database_url.parse(DATABASE_URL)
|
||||
}
|
||||
else:
|
||||
# Use SQLite for simple deployments
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': BASE_DIR / 'db.sqlite3',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Static files
|
||||
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
|
||||
|
||||
Loading…
Reference in New Issue
Block a user