kopia lustrzana https://github.com/djpeacher/django-projects
rodzic
518a484db0
commit
4b77c454c3
|
@ -9,7 +9,9 @@ https://docs.djangoproject.com/en/4.2/topics/settings/
|
|||
For the full list of settings and their values, see
|
||||
https://docs.djangoproject.com/en/4.2/ref/settings/
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import dj_database_url
|
||||
from pathlib import Path
|
||||
|
||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||
|
@ -20,12 +22,12 @@ BASE_DIR = Path(__file__).resolve().parent.parent
|
|||
# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = 'django-insecure-7@idp#yf6!fvk$aky7)q3kwhh@#_stp2+7dkulmdoz=ld=xy18'
|
||||
SECRET_KEY = os.getenv("DJANGO_SECRET_KEY", 'django-insecure-7@idp#yf6!fvk$aky7)q3kwhh@#_stp2+7dkulmdoz=ld=xy18')
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
DEBUG = os.getenv("DEBUG", "False") == "True"
|
||||
|
||||
ALLOWED_HOSTS = []
|
||||
ALLOWED_HOSTS = os.getenv("DJANGO_ALLOWED_HOSTS", "127.0.0.1,localhost").split(",")
|
||||
|
||||
|
||||
# Application definition
|
||||
|
@ -73,12 +75,19 @@ WSGI_APPLICATION = 'projects.wsgi.application'
|
|||
# Database
|
||||
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': BASE_DIR / 'db.sqlite3',
|
||||
if DEBUG is True:
|
||||
DATABASES = {
|
||||
"default": {
|
||||
"ENGINE": "django.db.backends.sqlite3",
|
||||
"NAME": os.path.join(BASE_DIR, "db.sqlite3"),
|
||||
}
|
||||
}
|
||||
elif len(sys.argv) > 0 and sys.argv[1] != 'collectstatic':
|
||||
if os.getenv("DATABASE_URL", None) is None:
|
||||
raise Exception("DATABASE_URL environment variable not defined")
|
||||
DATABASES = {
|
||||
"default": dj_database_url.parse(os.environ.get("DATABASE_URL")),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Password validation
|
||||
|
@ -115,7 +124,8 @@ USE_TZ = True
|
|||
# Static files (CSS, JavaScript, Images)
|
||||
# https://docs.djangoproject.com/en/4.2/howto/static-files/
|
||||
|
||||
STATIC_URL = 'static/'
|
||||
STATIC_URL = "/static/"
|
||||
STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles")
|
||||
|
||||
# Default primary key field type
|
||||
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
asgiref==3.7.2
|
||||
dj-database-url==2.0.0
|
||||
Django==4.2.2
|
||||
gunicorn==20.1.0
|
||||
psycopg2-binary==2.9.6
|
||||
sqlparse==0.4.4
|
||||
typing_extensions==4.6.3
|
Ładowanie…
Reference in New Issue