2
Django settings for config project.
4
Generated by 'django-admin startproject' using Django 4.0.4.
6
For more information on this file, see
7
https://docs.djangoproject.com/en/4.0/topics/settings/
9
For the full list of settings and their values, see
10
https://docs.djangoproject.com/en/4.0/ref/settings/
13
from pathlib import Path
15
from dotenv import load_dotenv
21
BASE_DIR = Path(__file__).resolve().parent.parent
22
load_dotenv(BASE_DIR / '.env')
27
SECRET_KEY = 'django-insecure-e@fxn*bi#)rga)(kh794ym@%@nflv=&3pc6%63!=sh@_8ny2=%'
30
DEBUG = True if os.getenv('DEBUG') == 'True' else False
34
ENV_TYPE = os.getenv('ENV_TYPE', 'prod')
45
'django.contrib.admin',
46
'django.contrib.auth',
47
'django.contrib.contenttypes',
48
'django.contrib.sessions',
49
'django.contrib.messages',
50
'django.contrib.staticfiles',
61
'django.middleware.security.SecurityMiddleware',
62
'django.contrib.sessions.middleware.SessionMiddleware',
63
'django.middleware.locale.LocaleMiddleware',
64
'django.middleware.common.CommonMiddleware',
65
'django.middleware.csrf.CsrfViewMiddleware',
66
'django.contrib.auth.middleware.AuthenticationMiddleware',
67
'django.contrib.messages.middleware.MessageMiddleware',
68
'django.middleware.clickjacking.XFrameOptionsMiddleware',
69
'debug_toolbar.middleware.DebugToolbarMiddleware',
72
ROOT_URLCONF = 'config.urls'
76
'BACKEND': 'django.template.backends.django.DjangoTemplates',
77
'DIRS': [BASE_DIR / 'templates'],
80
'context_processors': [
81
'django.template.context_processors.debug',
82
'django.template.context_processors.request',
83
'django.contrib.auth.context_processors.auth',
84
'django.contrib.messages.context_processors.messages',
85
'social_django.context_processors.backends',
86
'social_django.context_processors.login_redirect',
93
WSGI_APPLICATION = 'config.wsgi.application'
98
if ENV_TYPE == 'local':
101
'ENGINE': 'django.db.backends.sqlite3',
102
'NAME': BASE_DIR / 'db.sqlite3',
108
'ENGINE': 'django.db.backends.postgresql_psycopg2',
117
AUTH_PASSWORD_VALIDATORS = [
119
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
122
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
125
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
128
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
135
LANGUAGE_CODE = 'ru-ru'
137
TIME_ZONE = 'Europe/Moscow'
146
STATIC_URL = 'static/'
147
if ENV_TYPE == 'local':
152
STATIC_ROOT = BASE_DIR / 'static'
157
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
160
DEFAULT_AVATAR_URL = '/img/'
162
MEDIA_ROOT = BASE_DIR / 'media'
164
AUTH_USER_MODEL = 'authapp.User'
165
LOGIN_REDIRECT_URL = 'mainapp:home'
166
LOGOUT_REDIRECT_URL = 'mainapp:home'
168
MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage'
170
AUTHENTICATION_BACKENDS = (
171
'social_core.backends.github.GithubOAuth2',
172
'django.contrib.auth.backends.ModelBackend',
175
SOCIAL_AUTH_GITHUB_KEY = os.getenv('GITHUB_KEY')
176
SOCIAL_AUTH_GITHUB_SECRET = os.getenv('GITHUB_SECRET')
177
CRISPY_TEMPLATE_PACK = 'bootstrap4'
179
LOG_FILE = BASE_DIR / "log" / "main_log.log"
182
"disable_existing_loggers": False,
185
"format": "[%(asctime)s] %(levelname)s %(name)s (%(lineno)d) %(message)s"
191
"class": "logging.FileHandler",
192
"filename": LOG_FILE,
193
"formatter": "console",
195
"console": {"class": "logging.StreamHandler", "formatter": "console"},
198
"django": {"level": "INFO", "handlers": ["file", "console"]},
204
"BACKEND": "django_redis.cache.RedisCache",
205
"LOCATION": "redis://127.0.0.1:6379",
207
"CLIENT_CLASS": "django_redis.client.DefaultClient",
212
CELERY_BROKER_URL = "redis://localhost:6379"
213
CELERY_RESULT_BACKEND = "redis://localhost:6379"
229
EMAIL_BACKEND = "django.core.mail.backends.filebased.EmailBackend"
230
EMAIL_FILE_PATH = "emails-tmp"
232
LOCALE_PATHS = [BASE_DIR / 'locale']
234
SELENIUM_DRIVER_PATH_FF = BASE_DIR / 'var' / 'selenium' / 'geckodriver'