Configure settings for local and production
This commit is contained in:
+17
-3
@@ -1,9 +1,15 @@
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
SECRET_KEY = 'dev-only-change-me'
|
||||
DEBUG = True
|
||||
ALLOWED_HOSTS = ['*']
|
||||
|
||||
SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY', 'dev-only-change-me')
|
||||
DEBUG = os.environ.get('DJANGO_DEBUG', 'true').lower() in {'1', 'true', 'yes', 'on'}
|
||||
|
||||
ALLOWED_HOSTS = [host.strip() for host in os.environ.get(
|
||||
'DJANGO_ALLOWED_HOSTS',
|
||||
'localhost,127.0.0.1,my2dos.rucki.ch',
|
||||
).split(',') if host.strip()]
|
||||
|
||||
INSTALLED_APPS = [
|
||||
'django.contrib.admin',
|
||||
@@ -50,6 +56,14 @@ STATICFILES_DIRS = [BASE_DIR / 'static'] if (BASE_DIR / 'static').exists() else
|
||||
MEDIA_URL = 'media/'
|
||||
MEDIA_ROOT = BASE_DIR / 'media'
|
||||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||
|
||||
CSRF_TRUSTED_ORIGINS = [origin.strip() for origin in os.environ.get(
|
||||
'DJANGO_CSRF_TRUSTED_ORIGINS',
|
||||
'https://my2dos.rucki.ch,http://localhost:8000,http://127.0.0.1:8000',
|
||||
).split(',') if origin.strip()]
|
||||
|
||||
# Needed when Django runs behind a reverse proxy that terminates HTTPS.
|
||||
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
|
||||
LOGIN_URL = '/login/'
|
||||
LOGIN_REDIRECT_URL = '/'
|
||||
LOGOUT_REDIRECT_URL = '/login/'
|
||||
|
||||
Reference in New Issue
Block a user