2013-08-16 15:35:18 +04:00
|
|
|
"""
|
2018-03-06 14:28:25 +03:00
|
|
|
Base settings to build other settings files upon.
|
2013-08-16 15:35:18 +04:00
|
|
|
"""
|
2020-03-17 18:35:42 +03:00
|
|
|
from pathlib import Path
|
2018-03-06 14:28:25 +03:00
|
|
|
|
2015-04-20 00:09:00 +03:00
|
|
|
import environ
|
|
|
|
|
2020-04-30 01:07:21 +03:00
|
|
|
ROOT_DIR = Path(__file__).resolve(strict=True).parent.parent.parent
|
|
|
|
# {{ cookiecutter.project_slug }}/
|
2019-07-08 01:35:09 +03:00
|
|
|
APPS_DIR = ROOT_DIR / "{{ cookiecutter.project_slug }}"
|
2017-01-09 21:35:13 +03:00
|
|
|
env = environ.Env()
|
|
|
|
|
2019-03-18 20:49:43 +03:00
|
|
|
READ_DOT_ENV_FILE = env.bool("DJANGO_READ_DOT_ENV_FILE", default=False)
|
2017-01-09 21:35:13 +03:00
|
|
|
if READ_DOT_ENV_FILE:
|
2018-03-06 14:28:25 +03:00
|
|
|
# OS environment variables take precedence over variables from .env
|
2019-07-08 01:35:09 +03:00
|
|
|
env.read_env(str(ROOT_DIR / ".env"))
|
2018-03-06 14:28:25 +03:00
|
|
|
|
|
|
|
# GENERAL
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
# https://docs.djangoproject.com/en/dev/ref/settings/#debug
|
2019-03-18 20:49:43 +03:00
|
|
|
DEBUG = env.bool("DJANGO_DEBUG", False)
|
2018-03-06 14:28:25 +03:00
|
|
|
# Local time zone. Choices are
|
|
|
|
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
|
|
|
|
# though not all of them may be available with every OS.
|
|
|
|
# In Windows, this must be set to your system time zone.
|
2019-03-18 20:49:43 +03:00
|
|
|
TIME_ZONE = "{{ cookiecutter.timezone }}"
|
2018-03-06 14:28:25 +03:00
|
|
|
# https://docs.djangoproject.com/en/dev/ref/settings/#language-code
|
2019-03-18 20:49:43 +03:00
|
|
|
LANGUAGE_CODE = "en-us"
|
2018-03-06 14:28:25 +03:00
|
|
|
# https://docs.djangoproject.com/en/dev/ref/settings/#site-id
|
|
|
|
SITE_ID = 1
|
|
|
|
# https://docs.djangoproject.com/en/dev/ref/settings/#use-i18n
|
|
|
|
USE_I18N = True
|
|
|
|
# https://docs.djangoproject.com/en/dev/ref/settings/#use-l10n
|
|
|
|
USE_L10N = True
|
|
|
|
# https://docs.djangoproject.com/en/dev/ref/settings/#use-tz
|
|
|
|
USE_TZ = True
|
2019-05-17 18:34:32 +03:00
|
|
|
# https://docs.djangoproject.com/en/dev/ref/settings/#locale-paths
|
2019-07-08 01:35:09 +03:00
|
|
|
LOCALE_PATHS = [str(ROOT_DIR / "locale")]
|
2018-03-06 14:28:25 +03:00
|
|
|
|
|
|
|
# DATABASES
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
# https://docs.djangoproject.com/en/dev/ref/settings/#databases
|
2019-03-18 20:49:43 +03:00
|
|
|
{% if cookiecutter.use_docker == "y" -%}
|
|
|
|
DATABASES = {"default": env.db("DATABASE_URL")}
|
2018-03-06 14:28:25 +03:00
|
|
|
{%- else %}
|
|
|
|
DATABASES = {
|
2022-02-07 18:40:53 +03:00
|
|
|
"default": env.db(
|
|
|
|
"DATABASE_URL",
|
|
|
|
default="postgres://{% if cookiecutter.windows == 'y' %}localhost{% endif %}/{{cookiecutter.project_slug}}",
|
|
|
|
),
|
2018-03-06 14:28:25 +03:00
|
|
|
}
|
|
|
|
{%- endif %}
|
2019-03-18 20:49:43 +03:00
|
|
|
DATABASES["default"]["ATOMIC_REQUESTS"] = True
|
2021-11-24 11:05:53 +03:00
|
|
|
# https://docs.djangoproject.com/en/stable/ref/settings/#std:setting-DEFAULT_AUTO_FIELD
|
|
|
|
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
|
2018-03-06 14:28:25 +03:00
|
|
|
|
|
|
|
# URLS
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
# https://docs.djangoproject.com/en/dev/ref/settings/#root-urlconf
|
2019-03-18 20:49:43 +03:00
|
|
|
ROOT_URLCONF = "config.urls"
|
2018-03-06 14:28:25 +03:00
|
|
|
# https://docs.djangoproject.com/en/dev/ref/settings/#wsgi-application
|
2019-03-18 20:49:43 +03:00
|
|
|
WSGI_APPLICATION = "config.wsgi.application"
|
2015-04-20 00:09:00 +03:00
|
|
|
|
2018-03-06 14:28:25 +03:00
|
|
|
# APPS
|
2015-04-20 00:09:00 +03:00
|
|
|
# ------------------------------------------------------------------------------
|
2017-02-13 21:33:52 +03:00
|
|
|
DJANGO_APPS = [
|
2019-03-18 20:49:43 +03:00
|
|
|
"django.contrib.auth",
|
|
|
|
"django.contrib.contenttypes",
|
|
|
|
"django.contrib.sessions",
|
|
|
|
"django.contrib.sites",
|
|
|
|
"django.contrib.messages",
|
|
|
|
"django.contrib.staticfiles",
|
|
|
|
# "django.contrib.humanize", # Handy template tags
|
|
|
|
"django.contrib.admin",
|
2020-01-28 12:55:09 +03:00
|
|
|
"django.forms",
|
2017-02-13 21:33:52 +03:00
|
|
|
]
|
|
|
|
THIRD_PARTY_APPS = [
|
2019-03-18 20:49:43 +03:00
|
|
|
"crispy_forms",
|
2021-07-27 08:10:18 +03:00
|
|
|
"crispy_bootstrap5",
|
2019-03-18 20:49:43 +03:00
|
|
|
"allauth",
|
|
|
|
"allauth.account",
|
|
|
|
"allauth.socialaccount",
|
2019-05-31 13:45:59 +03:00
|
|
|
{%- if cookiecutter.use_celery == 'y' %}
|
|
|
|
"django_celery_beat",
|
2019-05-31 02:42:19 +03:00
|
|
|
{%- endif %}
|
2020-03-02 21:27:07 +03:00
|
|
|
{%- if cookiecutter.use_drf == "y" %}
|
2020-03-15 22:20:44 +03:00
|
|
|
"rest_framework",
|
2020-03-02 21:16:33 +03:00
|
|
|
"rest_framework.authtoken",
|
2020-07-19 03:53:55 +03:00
|
|
|
"corsheaders",
|
2022-01-19 21:14:36 +03:00
|
|
|
"drf_spectacular",
|
2020-03-02 21:16:33 +03:00
|
|
|
{%- endif %}
|
2019-05-31 13:45:59 +03:00
|
|
|
]
|
2019-05-31 02:59:58 +03:00
|
|
|
|
2017-02-13 21:33:52 +03:00
|
|
|
LOCAL_APPS = [
|
2021-11-24 11:05:53 +03:00
|
|
|
"{{ cookiecutter.project_slug }}.users",
|
2015-04-20 00:09:00 +03:00
|
|
|
# Your stuff: custom apps go here
|
2017-02-13 21:33:52 +03:00
|
|
|
]
|
2018-03-06 14:28:25 +03:00
|
|
|
# https://docs.djangoproject.com/en/dev/ref/settings/#installed-apps
|
2015-04-20 00:09:00 +03:00
|
|
|
INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + LOCAL_APPS
|
|
|
|
|
2018-03-06 14:28:25 +03:00
|
|
|
# MIGRATIONS
|
2015-04-20 00:09:00 +03:00
|
|
|
# ------------------------------------------------------------------------------
|
2018-03-06 14:28:25 +03:00
|
|
|
# https://docs.djangoproject.com/en/dev/ref/settings/#migration-modules
|
2019-03-18 20:49:43 +03:00
|
|
|
MIGRATION_MODULES = {"sites": "{{ cookiecutter.project_slug }}.contrib.sites.migrations"}
|
2015-04-20 00:09:00 +03:00
|
|
|
|
2018-03-06 14:28:25 +03:00
|
|
|
# AUTHENTICATION
|
2015-04-20 00:09:00 +03:00
|
|
|
# ------------------------------------------------------------------------------
|
2018-03-06 14:28:25 +03:00
|
|
|
# https://docs.djangoproject.com/en/dev/ref/settings/#authentication-backends
|
|
|
|
AUTHENTICATION_BACKENDS = [
|
2019-03-18 20:49:43 +03:00
|
|
|
"django.contrib.auth.backends.ModelBackend",
|
|
|
|
"allauth.account.auth_backends.AuthenticationBackend",
|
2018-03-06 14:28:25 +03:00
|
|
|
]
|
|
|
|
# https://docs.djangoproject.com/en/dev/ref/settings/#auth-user-model
|
2019-03-18 20:49:43 +03:00
|
|
|
AUTH_USER_MODEL = "users.User"
|
2018-03-06 14:28:25 +03:00
|
|
|
# https://docs.djangoproject.com/en/dev/ref/settings/#login-redirect-url
|
2019-03-18 20:49:43 +03:00
|
|
|
LOGIN_REDIRECT_URL = "users:redirect"
|
2018-03-06 14:28:25 +03:00
|
|
|
# https://docs.djangoproject.com/en/dev/ref/settings/#login-url
|
2019-03-18 20:49:43 +03:00
|
|
|
LOGIN_URL = "account_login"
|
2015-04-20 00:09:00 +03:00
|
|
|
|
2018-03-06 14:28:25 +03:00
|
|
|
# PASSWORDS
|
2015-04-20 00:09:00 +03:00
|
|
|
# ------------------------------------------------------------------------------
|
2018-03-06 14:28:25 +03:00
|
|
|
# https://docs.djangoproject.com/en/dev/ref/settings/#password-hashers
|
|
|
|
PASSWORD_HASHERS = [
|
|
|
|
# https://docs.djangoproject.com/en/dev/topics/auth/passwords/#using-argon2-with-django
|
2019-03-18 20:49:43 +03:00
|
|
|
"django.contrib.auth.hashers.Argon2PasswordHasher",
|
|
|
|
"django.contrib.auth.hashers.PBKDF2PasswordHasher",
|
|
|
|
"django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher",
|
|
|
|
"django.contrib.auth.hashers.BCryptSHA256PasswordHasher",
|
2018-03-06 14:28:25 +03:00
|
|
|
]
|
|
|
|
# https://docs.djangoproject.com/en/dev/ref/settings/#auth-password-validators
|
|
|
|
AUTH_PASSWORD_VALIDATORS = [
|
|
|
|
{
|
2019-03-18 20:49:43 +03:00
|
|
|
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator"
|
2018-03-06 14:28:25 +03:00
|
|
|
},
|
2019-03-18 20:49:43 +03:00
|
|
|
{"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator"},
|
|
|
|
{"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator"},
|
|
|
|
{"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator"},
|
2018-03-06 14:28:25 +03:00
|
|
|
]
|
2015-04-20 00:09:00 +03:00
|
|
|
|
2018-03-06 14:28:25 +03:00
|
|
|
# MIDDLEWARE
|
2015-04-20 00:09:00 +03:00
|
|
|
# ------------------------------------------------------------------------------
|
2018-03-06 14:28:25 +03:00
|
|
|
# https://docs.djangoproject.com/en/dev/ref/settings/#middleware
|
|
|
|
MIDDLEWARE = [
|
2019-03-18 20:49:43 +03:00
|
|
|
"django.middleware.security.SecurityMiddleware",
|
2020-07-19 03:53:55 +03:00
|
|
|
{%- if cookiecutter.use_drf == 'y' %}
|
|
|
|
"corsheaders.middleware.CorsMiddleware",
|
|
|
|
{%- endif %}
|
2019-11-07 13:59:23 +03:00
|
|
|
{%- if cookiecutter.use_whitenoise == 'y' %}
|
|
|
|
"whitenoise.middleware.WhiteNoiseMiddleware",
|
|
|
|
{%- endif %}
|
2019-03-18 20:49:43 +03:00
|
|
|
"django.contrib.sessions.middleware.SessionMiddleware",
|
2019-05-17 17:57:13 +03:00
|
|
|
"django.middleware.locale.LocaleMiddleware",
|
2019-03-18 20:49:43 +03:00
|
|
|
"django.middleware.common.CommonMiddleware",
|
|
|
|
"django.middleware.csrf.CsrfViewMiddleware",
|
|
|
|
"django.contrib.auth.middleware.AuthenticationMiddleware",
|
|
|
|
"django.contrib.messages.middleware.MessageMiddleware",
|
2019-12-10 14:46:52 +03:00
|
|
|
"django.middleware.common.BrokenLinkEmailsMiddleware",
|
2019-03-18 20:49:43 +03:00
|
|
|
"django.middleware.clickjacking.XFrameOptionsMiddleware",
|
2017-02-13 21:33:52 +03:00
|
|
|
]
|
2015-04-20 00:09:00 +03:00
|
|
|
|
2018-03-06 14:28:25 +03:00
|
|
|
# STATIC
|
2015-04-20 00:09:00 +03:00
|
|
|
# ------------------------------------------------------------------------------
|
2018-03-06 14:28:25 +03:00
|
|
|
# https://docs.djangoproject.com/en/dev/ref/settings/#static-root
|
2019-07-08 01:35:09 +03:00
|
|
|
STATIC_ROOT = str(ROOT_DIR / "staticfiles")
|
2018-03-06 14:28:25 +03:00
|
|
|
# https://docs.djangoproject.com/en/dev/ref/settings/#static-url
|
2019-03-18 20:49:43 +03:00
|
|
|
STATIC_URL = "/static/"
|
2018-03-06 14:28:25 +03:00
|
|
|
# https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#std:setting-STATICFILES_DIRS
|
2019-07-08 01:35:09 +03:00
|
|
|
STATICFILES_DIRS = [str(APPS_DIR / "static")]
|
2018-03-06 14:28:25 +03:00
|
|
|
# https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#staticfiles-finders
|
|
|
|
STATICFILES_FINDERS = [
|
2019-03-18 20:49:43 +03:00
|
|
|
"django.contrib.staticfiles.finders.FileSystemFinder",
|
|
|
|
"django.contrib.staticfiles.finders.AppDirectoriesFinder",
|
2018-03-06 14:28:25 +03:00
|
|
|
]
|
2015-04-20 00:09:00 +03:00
|
|
|
|
2018-03-06 14:28:25 +03:00
|
|
|
# MEDIA
|
2015-04-20 00:09:00 +03:00
|
|
|
# ------------------------------------------------------------------------------
|
2018-03-06 14:28:25 +03:00
|
|
|
# https://docs.djangoproject.com/en/dev/ref/settings/#media-root
|
2019-07-08 01:35:09 +03:00
|
|
|
MEDIA_ROOT = str(APPS_DIR / "media")
|
2018-03-06 14:28:25 +03:00
|
|
|
# https://docs.djangoproject.com/en/dev/ref/settings/#media-url
|
2019-03-18 20:49:43 +03:00
|
|
|
MEDIA_URL = "/media/"
|
2015-04-20 00:09:00 +03:00
|
|
|
|
2018-03-06 14:28:25 +03:00
|
|
|
# TEMPLATES
|
2015-04-20 00:09:00 +03:00
|
|
|
# ------------------------------------------------------------------------------
|
2018-03-06 14:28:25 +03:00
|
|
|
# https://docs.djangoproject.com/en/dev/ref/settings/#templates
|
2015-05-08 05:13:49 +03:00
|
|
|
TEMPLATES = [
|
|
|
|
{
|
2018-03-06 14:28:25 +03:00
|
|
|
# https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-TEMPLATES-BACKEND
|
2019-03-18 20:49:43 +03:00
|
|
|
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
2021-12-24 22:35:09 +03:00
|
|
|
# https://docs.djangoproject.com/en/dev/ref/settings/#dirs
|
2019-07-08 01:35:09 +03:00
|
|
|
"DIRS": [str(APPS_DIR / "templates")],
|
2021-12-24 22:35:09 +03:00
|
|
|
# https://docs.djangoproject.com/en/dev/ref/settings/#app-dirs
|
|
|
|
"APP_DIRS": True,
|
2019-03-18 20:49:43 +03:00
|
|
|
"OPTIONS": {
|
2018-03-06 14:28:25 +03:00
|
|
|
# https://docs.djangoproject.com/en/dev/ref/settings/#template-context-processors
|
2019-03-18 20:49:43 +03:00
|
|
|
"context_processors": [
|
|
|
|
"django.template.context_processors.debug",
|
|
|
|
"django.template.context_processors.request",
|
|
|
|
"django.contrib.auth.context_processors.auth",
|
|
|
|
"django.template.context_processors.i18n",
|
|
|
|
"django.template.context_processors.media",
|
|
|
|
"django.template.context_processors.static",
|
|
|
|
"django.template.context_processors.tz",
|
|
|
|
"django.contrib.messages.context_processors.messages",
|
2021-12-27 14:37:33 +03:00
|
|
|
"{{cookiecutter.project_slug}}.users.context_processors.allauth_settings",
|
2015-05-08 05:13:49 +03:00
|
|
|
],
|
|
|
|
},
|
2019-03-18 20:49:43 +03:00
|
|
|
}
|
2015-05-08 05:13:49 +03:00
|
|
|
]
|
2020-01-28 12:55:09 +03:00
|
|
|
|
|
|
|
# https://docs.djangoproject.com/en/dev/ref/settings/#form-renderer
|
|
|
|
FORM_RENDERER = "django.forms.renderers.TemplatesSetting"
|
|
|
|
|
2018-03-06 14:28:25 +03:00
|
|
|
# http://django-crispy-forms.readthedocs.io/en/latest/install.html#template-packs
|
2021-07-27 08:10:18 +03:00
|
|
|
CRISPY_TEMPLATE_PACK = "bootstrap5"
|
|
|
|
CRISPY_ALLOWED_TEMPLATE_PACKS = "bootstrap5"
|
2015-04-20 00:09:00 +03:00
|
|
|
|
2018-03-06 14:28:25 +03:00
|
|
|
# FIXTURES
|
2015-04-20 00:09:00 +03:00
|
|
|
# ------------------------------------------------------------------------------
|
2018-03-06 14:28:25 +03:00
|
|
|
# https://docs.djangoproject.com/en/dev/ref/settings/#fixture-dirs
|
2019-07-08 01:35:09 +03:00
|
|
|
FIXTURE_DIRS = (str(APPS_DIR / "fixtures"),)
|
2015-04-20 00:09:00 +03:00
|
|
|
|
2018-11-12 23:04:03 +03:00
|
|
|
# SECURITY
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
# https://docs.djangoproject.com/en/dev/ref/settings/#session-cookie-httponly
|
|
|
|
SESSION_COOKIE_HTTPONLY = True
|
|
|
|
# https://docs.djangoproject.com/en/dev/ref/settings/#csrf-cookie-httponly
|
|
|
|
CSRF_COOKIE_HTTPONLY = True
|
|
|
|
# https://docs.djangoproject.com/en/dev/ref/settings/#secure-browser-xss-filter
|
|
|
|
SECURE_BROWSER_XSS_FILTER = True
|
|
|
|
# https://docs.djangoproject.com/en/dev/ref/settings/#x-frame-options
|
2019-03-18 20:49:43 +03:00
|
|
|
X_FRAME_OPTIONS = "DENY"
|
2018-11-12 23:04:03 +03:00
|
|
|
|
2018-03-06 14:28:25 +03:00
|
|
|
# EMAIL
|
2017-03-17 05:19:42 +03:00
|
|
|
# ------------------------------------------------------------------------------
|
2018-03-06 14:28:25 +03:00
|
|
|
# https://docs.djangoproject.com/en/dev/ref/settings/#email-backend
|
2019-03-18 20:49:43 +03:00
|
|
|
EMAIL_BACKEND = env(
|
2021-03-03 01:50:28 +03:00
|
|
|
"DJANGO_EMAIL_BACKEND",
|
|
|
|
default="django.core.mail.backends.smtp.EmailBackend",
|
2019-03-18 20:49:43 +03:00
|
|
|
)
|
2020-03-24 00:41:51 +03:00
|
|
|
# https://docs.djangoproject.com/en/dev/ref/settings/#email-timeout
|
2019-07-09 04:11:50 +03:00
|
|
|
EMAIL_TIMEOUT = 5
|
2016-09-15 06:37:57 +03:00
|
|
|
|
2018-03-06 14:28:25 +03:00
|
|
|
# ADMIN
|
2016-09-15 06:37:57 +03:00
|
|
|
# ------------------------------------------------------------------------------
|
2018-05-14 10:09:24 +03:00
|
|
|
# Django Admin URL.
|
2019-03-18 20:49:43 +03:00
|
|
|
ADMIN_URL = "admin/"
|
2018-03-06 14:28:25 +03:00
|
|
|
# https://docs.djangoproject.com/en/dev/ref/settings/#admins
|
2019-03-18 20:49:43 +03:00
|
|
|
ADMINS = [("""{{cookiecutter.author_name}}""", "{{cookiecutter.email}}")]
|
2018-03-06 14:28:25 +03:00
|
|
|
# https://docs.djangoproject.com/en/dev/ref/settings/#managers
|
|
|
|
MANAGERS = ADMINS
|
2016-09-15 06:37:57 +03:00
|
|
|
|
2019-04-12 18:59:34 +03:00
|
|
|
# LOGGING
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
# https://docs.djangoproject.com/en/dev/ref/settings/#logging
|
|
|
|
# See https://docs.djangoproject.com/en/dev/topics/logging for
|
|
|
|
# more details on how to customize your logging configuration.
|
|
|
|
LOGGING = {
|
|
|
|
"version": 1,
|
|
|
|
"disable_existing_loggers": False,
|
|
|
|
"formatters": {
|
|
|
|
"verbose": {
|
|
|
|
"format": "%(levelname)s %(asctime)s %(module)s "
|
|
|
|
"%(process)d %(thread)d %(message)s"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"handlers": {
|
|
|
|
"console": {
|
|
|
|
"level": "DEBUG",
|
|
|
|
"class": "logging.StreamHandler",
|
|
|
|
"formatter": "verbose",
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"root": {"level": "INFO", "handlers": ["console"]},
|
|
|
|
}
|
|
|
|
|
2018-03-06 14:28:25 +03:00
|
|
|
{% if cookiecutter.use_celery == 'y' -%}
|
|
|
|
# Celery
|
2015-04-20 00:09:00 +03:00
|
|
|
# ------------------------------------------------------------------------------
|
2018-06-21 22:38:48 +03:00
|
|
|
if USE_TZ:
|
2022-04-01 19:32:05 +03:00
|
|
|
# https://docs.celeryq.dev/en/stable/userguide/configuration.html#std:setting-timezone
|
2018-06-21 22:38:48 +03:00
|
|
|
CELERY_TIMEZONE = TIME_ZONE
|
2022-04-01 19:32:05 +03:00
|
|
|
# https://docs.celeryq.dev/en/stable/userguide/configuration.html#std:setting-broker_url
|
2019-03-18 20:49:43 +03:00
|
|
|
CELERY_BROKER_URL = env("CELERY_BROKER_URL")
|
2022-04-01 19:32:05 +03:00
|
|
|
# https://docs.celeryq.dev/en/stable/userguide/configuration.html#std:setting-result_backend
|
2018-06-21 22:38:48 +03:00
|
|
|
CELERY_RESULT_BACKEND = CELERY_BROKER_URL
|
2022-04-01 19:32:05 +03:00
|
|
|
# https://docs.celeryq.dev/en/stable/userguide/configuration.html#std:setting-accept_content
|
2019-03-18 20:49:43 +03:00
|
|
|
CELERY_ACCEPT_CONTENT = ["json"]
|
2022-04-01 19:32:05 +03:00
|
|
|
# https://docs.celeryq.dev/en/stable/userguide/configuration.html#std:setting-task_serializer
|
2019-03-18 20:49:43 +03:00
|
|
|
CELERY_TASK_SERIALIZER = "json"
|
2022-04-01 19:32:05 +03:00
|
|
|
# https://docs.celeryq.dev/en/stable/userguide/configuration.html#std:setting-result_serializer
|
2019-03-18 20:49:43 +03:00
|
|
|
CELERY_RESULT_SERIALIZER = "json"
|
2022-04-01 19:32:05 +03:00
|
|
|
# https://docs.celeryq.dev/en/stable/userguide/configuration.html#task-time-limit
|
2018-06-21 22:38:48 +03:00
|
|
|
# TODO: set to whatever value is adequate in your circumstances
|
2019-05-27 16:46:07 +03:00
|
|
|
CELERY_TASK_TIME_LIMIT = 5 * 60
|
2022-04-01 19:32:05 +03:00
|
|
|
# https://docs.celeryq.dev/en/stable/userguide/configuration.html#task-soft-time-limit
|
2018-06-21 22:38:48 +03:00
|
|
|
# TODO: set to whatever value is adequate in your circumstances
|
2019-05-27 16:46:07 +03:00
|
|
|
CELERY_TASK_SOFT_TIME_LIMIT = 60
|
2022-04-01 19:32:05 +03:00
|
|
|
# https://docs.celeryq.dev/en/stable/userguide/configuration.html#beat-scheduler
|
2019-05-31 02:42:19 +03:00
|
|
|
CELERY_BEAT_SCHEDULER = "django_celery_beat.schedulers:DatabaseScheduler"
|
2015-10-04 00:54:29 +03:00
|
|
|
|
2018-03-06 14:28:25 +03:00
|
|
|
{%- endif %}
|
|
|
|
# django-allauth
|
|
|
|
# ------------------------------------------------------------------------------
|
2019-03-18 20:49:43 +03:00
|
|
|
ACCOUNT_ALLOW_REGISTRATION = env.bool("DJANGO_ACCOUNT_ALLOW_REGISTRATION", True)
|
2018-03-06 14:28:25 +03:00
|
|
|
# https://django-allauth.readthedocs.io/en/latest/configuration.html
|
2019-03-18 20:49:43 +03:00
|
|
|
ACCOUNT_AUTHENTICATION_METHOD = "username"
|
2018-03-06 14:28:25 +03:00
|
|
|
# https://django-allauth.readthedocs.io/en/latest/configuration.html
|
|
|
|
ACCOUNT_EMAIL_REQUIRED = True
|
|
|
|
# https://django-allauth.readthedocs.io/en/latest/configuration.html
|
2019-03-18 20:49:43 +03:00
|
|
|
ACCOUNT_EMAIL_VERIFICATION = "mandatory"
|
2018-03-06 14:28:25 +03:00
|
|
|
# https://django-allauth.readthedocs.io/en/latest/configuration.html
|
2019-03-18 20:49:43 +03:00
|
|
|
ACCOUNT_ADAPTER = "{{cookiecutter.project_slug}}.users.adapters.AccountAdapter"
|
2022-01-13 21:38:35 +03:00
|
|
|
# https://django-allauth.readthedocs.io/en/latest/forms.html
|
|
|
|
ACCOUNT_FORMS = {"signup": "{{cookiecutter.project_slug}}.users.forms.UserSignupForm"}
|
2018-03-06 14:28:25 +03:00
|
|
|
# https://django-allauth.readthedocs.io/en/latest/configuration.html
|
2019-03-18 20:49:43 +03:00
|
|
|
SOCIALACCOUNT_ADAPTER = "{{cookiecutter.project_slug}}.users.adapters.SocialAccountAdapter"
|
2022-01-13 21:38:35 +03:00
|
|
|
# https://django-allauth.readthedocs.io/en/latest/forms.html
|
|
|
|
SOCIALACCOUNT_FORMS = {"signup": "{{cookiecutter.project_slug}}.users.forms.UserSocialSignupForm"}
|
2022-03-20 18:00:40 +03:00
|
|
|
{% if cookiecutter.frontend_pipeline == 'Django Compressor' -%}
|
2016-06-18 05:07:45 +03:00
|
|
|
# django-compressor
|
|
|
|
# ------------------------------------------------------------------------------
|
2018-03-06 14:28:25 +03:00
|
|
|
# https://django-compressor.readthedocs.io/en/latest/quickstart/#installation
|
2019-03-18 20:49:43 +03:00
|
|
|
INSTALLED_APPS += ["compressor"]
|
|
|
|
STATICFILES_FINDERS += ["compressor.finders.CompressorFinder"]
|
2019-09-13 09:43:12 +03:00
|
|
|
{%- endif %}
|
|
|
|
{% if cookiecutter.use_drf == "y" -%}
|
2020-04-11 20:49:04 +03:00
|
|
|
# django-rest-framework
|
2019-09-13 09:43:12 +03:00
|
|
|
# -------------------------------------------------------------------------------
|
|
|
|
# django-rest-framework - https://www.django-rest-framework.org/api-guide/settings/
|
|
|
|
REST_FRAMEWORK = {
|
2020-01-23 18:04:30 +03:00
|
|
|
"DEFAULT_AUTHENTICATION_CLASSES": (
|
|
|
|
"rest_framework.authentication.SessionAuthentication",
|
|
|
|
"rest_framework.authentication.TokenAuthentication",
|
2019-09-13 09:43:12 +03:00
|
|
|
),
|
2020-01-23 18:04:30 +03:00
|
|
|
"DEFAULT_PERMISSION_CLASSES": ("rest_framework.permissions.IsAuthenticated",),
|
2022-02-16 15:25:32 +03:00
|
|
|
"DEFAULT_SCHEMA_CLASS": "drf_spectacular.openapi.AutoSchema",
|
2019-09-13 09:43:12 +03:00
|
|
|
}
|
2020-07-19 03:53:55 +03:00
|
|
|
|
|
|
|
# django-cors-headers - https://github.com/adamchainz/django-cors-headers#setup
|
2020-07-20 19:21:06 +03:00
|
|
|
CORS_URLS_REGEX = r"^/api/.*$"
|
2020-07-19 03:53:55 +03:00
|
|
|
|
2022-02-08 22:36:36 +03:00
|
|
|
# By Default swagger ui is available only to admin user(s). You can change permission classes to change that
|
2022-01-19 21:14:36 +03:00
|
|
|
# See more configuration options at https://drf-spectacular.readthedocs.io/en/latest/settings.html#settings
|
|
|
|
SPECTACULAR_SETTINGS = {
|
|
|
|
"TITLE": "{{ cookiecutter.project_name }} API",
|
2022-02-08 22:36:36 +03:00
|
|
|
"DESCRIPTION": "Documentation of API endpoints of {{ cookiecutter.project_name }}",
|
2022-01-19 21:14:36 +03:00
|
|
|
"VERSION": "1.0.0",
|
|
|
|
"SERVE_PERMISSIONS": ["rest_framework.permissions.IsAdminUser"],
|
|
|
|
"SERVERS": [
|
2022-02-15 17:52:20 +03:00
|
|
|
{"url": "http://127.0.0.1:8000", "description": "Local Development server"},
|
2022-01-19 21:14:36 +03:00
|
|
|
{"url": "https://{{ cookiecutter.domain_name }}", "description": "Production server"},
|
|
|
|
],
|
|
|
|
}
|
2018-03-06 14:28:25 +03:00
|
|
|
{%- endif %}
|
|
|
|
# Your stuff...
|
2016-08-31 18:56:25 +03:00
|
|
|
# ------------------------------------------------------------------------------
|