cofigurate settings
This commit is contained in:
0
config/conf/__init__.py
Normal file
0
config/conf/__init__.py
Normal file
18
config/env.py
Normal file
18
config/env.py
Normal file
@@ -0,0 +1,18 @@
|
||||
import os
|
||||
|
||||
import environ
|
||||
|
||||
environ.Env.read_env(os.path.join('.env'))
|
||||
|
||||
|
||||
env = environ.Env(
|
||||
DB_ENGINE=(str, 'django.db.backends.postgresql'),
|
||||
DB_NAME=(str),
|
||||
DB_USER=(str, 'postgres'),
|
||||
DB_PASSWORD=(str),
|
||||
DB_HOST=(str, 'localhost'),
|
||||
DB_PORT=(int, 5432),
|
||||
DEBUG=(bool, False),
|
||||
ALLOWED_HOSTS=(list, ['localhost', '127.0.0.1']),
|
||||
SECRET_KEY=(str)
|
||||
)
|
||||
@@ -1,5 +1,6 @@
|
||||
from pathlib import Path
|
||||
|
||||
from config.env import env
|
||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent.parent
|
||||
|
||||
@@ -8,17 +9,16 @@ BASE_DIR = Path(__file__).resolve().parent.parent.parent
|
||||
# See https://docs.djangoproject.com/en/5.2/howto/deployment/checklist/
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = 'django-insecure-p4ybgfc_5v7@l8ocv9$8%i!(kn2ey$@l#k6rg=fux-n41!(3&e'
|
||||
SECRET_KEY = env.str('SECRET_KEY')
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
DEBUG = env.bool("DEBUG")
|
||||
|
||||
ALLOWED_HOSTS = []
|
||||
ALLOWED_HOSTS = env.list('ALLOWED_HOSTS')
|
||||
|
||||
|
||||
# Application definition
|
||||
|
||||
INSTALLED_APPS = [
|
||||
DJANGO_APPS = [
|
||||
'django.contrib.admin',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
@@ -27,6 +27,22 @@ INSTALLED_APPS = [
|
||||
'django.contrib.staticfiles',
|
||||
]
|
||||
|
||||
APPS = [
|
||||
'core.apps.shared',
|
||||
'core.apps.accounts',
|
||||
'core.apps.contracts',
|
||||
]
|
||||
|
||||
PACKAGES = [
|
||||
|
||||
]
|
||||
|
||||
INSTALLED_APPS = []
|
||||
INSTALLED_APPS += DJANGO_APPS
|
||||
INSTALLED_APPS += PACKAGES
|
||||
INSTALLED_APPS += APPS
|
||||
|
||||
|
||||
MIDDLEWARE = [
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
@@ -55,26 +71,24 @@ TEMPLATES = [
|
||||
]
|
||||
|
||||
WSGI_APPLICATION = 'config.wsgi.application'
|
||||
|
||||
ASGI_APPLICATION = 'config.asgi.application'
|
||||
|
||||
# Database
|
||||
# https://docs.djangoproject.com/en/5.2/ref/settings/#databases
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.postgresql',
|
||||
'NAME': 'trustme_db',
|
||||
'USER': 'postgres',
|
||||
'PASSWORD': '20090912',
|
||||
'HOST': 'db',
|
||||
'PORT': 5432,
|
||||
'ENGINE': env.str('DB_ENGINE'),
|
||||
'NAME': env.str('DB_NAME'),
|
||||
'USER': env.str('DB_USER'),
|
||||
'PASSWORD': env.str('DB_PASSWORD'),
|
||||
'HOST': env.str('DB_HOST'),
|
||||
'PORT': env.int('DB_PORT'),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Password validation
|
||||
# https://docs.djangoproject.com/en/5.2/ref/settings/#auth-password-validators
|
||||
|
||||
AUTH_PASSWORD_VALIDATORS = [
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
from config.settings.base import *
|
||||
@@ -0,0 +1 @@
|
||||
from config.settings.base import *
|
||||
Reference in New Issue
Block a user