chore: Prepare settings for production
This commit is contained in:
parent
b02da15fb2
commit
362e9792e9
1 changed files with 16 additions and 11 deletions
|
@ -10,23 +10,24 @@ For the full list of settings and their values, see
|
||||||
https://docs.djangoproject.com/en/4.0/ref/settings/
|
https://docs.djangoproject.com/en/4.0/ref/settings/
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||||
|
|
||||||
|
production = os.environ.get('PRODUCTION', False) == 'true'
|
||||||
|
|
||||||
# Quick-start development settings - unsuitable for production
|
if production:
|
||||||
# See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/
|
SECRET_KEY = os.environ.get('SECRET_KEY')
|
||||||
|
else:
|
||||||
|
SECRET_KEY = 'django-insecure-de-2*zq9g3v5!bjit%^hh5=je_a6mk!sc4)r@+a3ubd*e^7x1a'
|
||||||
|
|
||||||
# SECURITY WARNING: keep the secret key used in production secret!
|
DEBUG = not production
|
||||||
SECRET_KEY = 'django-insecure-de-2*zq9g3v5!bjit%^hh5=je_a6mk!sc4)r@+a3ubd*e^7x1a'
|
|
||||||
|
|
||||||
# SECURITY WARNING: don't run with debug turned on in production!
|
|
||||||
DEBUG = True
|
|
||||||
|
|
||||||
ALLOWED_HOSTS = []
|
|
||||||
|
|
||||||
|
ALLOWED_HOSTS = [
|
||||||
|
'*',
|
||||||
|
]
|
||||||
|
|
||||||
# Application definition
|
# Application definition
|
||||||
|
|
||||||
|
@ -78,8 +79,12 @@ WSGI_APPLICATION = 'djangotea.wsgi.application'
|
||||||
|
|
||||||
DATABASES = {
|
DATABASES = {
|
||||||
'default': {
|
'default': {
|
||||||
'ENGINE': 'django.db.backends.sqlite3',
|
"ENGINE": os.environ.get("SQL_ENGINE", "django.db.backends.sqlite3"),
|
||||||
'NAME': BASE_DIR / 'db.sqlite3',
|
"NAME": os.environ.get("SQL_DATABASE", os.path.join(BASE_DIR, "db.sqlite3")),
|
||||||
|
"USER": os.environ.get("SQL_USER", "user"),
|
||||||
|
"PASSWORD": os.environ.get("SQL_PASSWORD", "password"),
|
||||||
|
"HOST": os.environ.get("SQL_HOST", "localhost"),
|
||||||
|
"PORT": os.environ.get("SQL_PORT", "5432"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue