2024-02-13 13:57:53 +03:00
|
|
|
# ruff: noqa: E501
|
|
|
|
from .base import * # noqa: F403
|
|
|
|
from .base import INSTALLED_APPS
|
|
|
|
from .base import MIDDLEWARE
|
|
|
|
{%- if cookiecutter.frontend_pipeline == 'Webpack' %}
|
|
|
|
from .base import WEBPACK_LOADER
|
|
|
|
{%- endif %}
|
2018-03-06 19:56:27 +03:00
|
|
|
from .base import env
|
2015-04-20 00:09:00 +03:00
|
|
|
|
2018-03-06 14:28:25 +03:00
|
|
|
# GENERAL
|
2018-03-04 17:51:37 +03:00
|
|
|
# ------------------------------------------------------------------------------
|
2018-03-06 14:28:25 +03:00
|
|
|
# https://docs.djangoproject.com/en/dev/ref/settings/#debug
|
2018-05-14 10:21:33 +03:00
|
|
|
DEBUG = True
|
2018-03-06 14:28:25 +03:00
|
|
|
# https://docs.djangoproject.com/en/dev/ref/settings/#secret-key
|
2019-03-18 20:49:43 +03:00
|
|
|
SECRET_KEY = env(
|
|
|
|
"DJANGO_SECRET_KEY",
|
|
|
|
default="!!!SET DJANGO_SECRET_KEY!!!",
|
|
|
|
)
|
2018-03-06 14:28:25 +03:00
|
|
|
# https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
|
2024-02-13 13:57:53 +03:00
|
|
|
ALLOWED_HOSTS = ["localhost", "0.0.0.0", "127.0.0.1"] # noqa: S104
|
2018-03-04 17:51:37 +03:00
|
|
|
|
2018-03-06 14:28:25 +03:00
|
|
|
# CACHES
|
2015-04-20 00:09:00 +03:00
|
|
|
# ------------------------------------------------------------------------------
|
2018-03-06 14:28:25 +03:00
|
|
|
# https://docs.djangoproject.com/en/dev/ref/settings/#caches
|
|
|
|
CACHES = {
|
2019-03-18 20:49:43 +03:00
|
|
|
"default": {
|
|
|
|
"BACKEND": "django.core.cache.backends.locmem.LocMemCache",
|
|
|
|
"LOCATION": "",
|
2024-02-13 13:57:53 +03:00
|
|
|
},
|
2018-03-06 14:28:25 +03:00
|
|
|
}
|
2015-04-20 00:09:00 +03:00
|
|
|
|
2018-03-06 14:28:25 +03:00
|
|
|
# EMAIL
|
2015-04-20 00:09:00 +03:00
|
|
|
# ------------------------------------------------------------------------------
|
2023-09-06 22:41:01 +03:00
|
|
|
{% if cookiecutter.use_mailpit == 'y' and cookiecutter.use_docker == 'y' -%}
|
2018-03-06 14:28:25 +03:00
|
|
|
# https://docs.djangoproject.com/en/dev/ref/settings/#email-host
|
2023-09-06 22:41:01 +03:00
|
|
|
EMAIL_HOST = env("EMAIL_HOST", default="mailpit")
|
2019-08-21 18:28:55 +03:00
|
|
|
# https://docs.djangoproject.com/en/dev/ref/settings/#email-port
|
|
|
|
EMAIL_PORT = 1025
|
2023-09-06 22:41:01 +03:00
|
|
|
{%- elif cookiecutter.use_mailpit == 'y' and cookiecutter.use_docker == 'n' -%}
|
2018-03-06 14:28:25 +03:00
|
|
|
# https://docs.djangoproject.com/en/dev/ref/settings/#email-host
|
2019-03-18 20:49:43 +03:00
|
|
|
EMAIL_HOST = "localhost"
|
2019-08-21 18:28:55 +03:00
|
|
|
# https://docs.djangoproject.com/en/dev/ref/settings/#email-port
|
|
|
|
EMAIL_PORT = 1025
|
2018-03-06 14:28:25 +03:00
|
|
|
{%- else -%}
|
|
|
|
# https://docs.djangoproject.com/en/dev/ref/settings/#email-backend
|
2024-02-13 13:57:53 +03:00
|
|
|
EMAIL_BACKEND = env(
|
|
|
|
"DJANGO_EMAIL_BACKEND", default="django.core.mail.backends.console.EmailBackend",
|
|
|
|
)
|
2018-03-06 14:28:25 +03:00
|
|
|
{%- endif %}
|
2014-05-25 18:50:13 +04:00
|
|
|
|
2019-11-07 13:59:23 +03:00
|
|
|
{%- if cookiecutter.use_whitenoise == 'y' %}
|
|
|
|
|
|
|
|
# WhiteNoise
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
# http://whitenoise.evans.io/en/latest/django.html#using-whitenoise-in-development
|
2024-02-13 13:57:53 +03:00
|
|
|
INSTALLED_APPS = ["whitenoise.runserver_nostatic", *INSTALLED_APPS]
|
2019-11-07 13:59:23 +03:00
|
|
|
{% endif %}
|
|
|
|
|
2015-04-20 00:09:00 +03:00
|
|
|
# django-debug-toolbar
|
|
|
|
# ------------------------------------------------------------------------------
|
2018-03-06 14:28:25 +03:00
|
|
|
# https://django-debug-toolbar.readthedocs.io/en/latest/installation.html#prerequisites
|
2024-02-13 13:57:53 +03:00
|
|
|
INSTALLED_APPS += ["debug_toolbar"]
|
2018-03-06 14:28:25 +03:00
|
|
|
# https://django-debug-toolbar.readthedocs.io/en/latest/installation.html#middleware
|
2024-02-13 13:57:53 +03:00
|
|
|
MIDDLEWARE += ["debug_toolbar.middleware.DebugToolbarMiddleware"]
|
2018-03-06 14:28:25 +03:00
|
|
|
# https://django-debug-toolbar.readthedocs.io/en/latest/configuration.html#debug-toolbar-config
|
2015-04-20 00:09:00 +03:00
|
|
|
DEBUG_TOOLBAR_CONFIG = {
|
2019-03-18 20:49:43 +03:00
|
|
|
"DISABLE_PANELS": ["debug_toolbar.panels.redirects.RedirectsPanel"],
|
|
|
|
"SHOW_TEMPLATE_CONTEXT": True,
|
2015-04-20 00:09:00 +03:00
|
|
|
}
|
2018-03-06 14:28:25 +03:00
|
|
|
# https://django-debug-toolbar.readthedocs.io/en/latest/installation.html#internal-ips
|
2019-03-18 20:49:43 +03:00
|
|
|
INTERNAL_IPS = ["127.0.0.1", "10.0.2.2"]
|
2018-03-06 14:28:25 +03:00
|
|
|
{% if cookiecutter.use_docker == 'y' -%}
|
2019-03-18 20:49:43 +03:00
|
|
|
if env("USE_DOCKER") == "yes":
|
2018-05-09 13:15:35 +03:00
|
|
|
import socket
|
2019-03-18 20:49:43 +03:00
|
|
|
|
2018-03-08 15:54:24 +03:00
|
|
|
hostname, _, ips = socket.gethostbyname_ex(socket.gethostname())
|
2020-04-08 01:29:46 +03:00
|
|
|
INTERNAL_IPS += [".".join(ip.split(".")[:-1] + ["1"]) for ip in ips]
|
2023-01-29 15:12:12 +03:00
|
|
|
{%- if cookiecutter.frontend_pipeline in ['Gulp', 'Webpack'] %}
|
2021-01-28 12:19:14 +03:00
|
|
|
try:
|
|
|
|
_, _, ips = socket.gethostbyname_ex("node")
|
|
|
|
INTERNAL_IPS.extend(ips)
|
|
|
|
except socket.gaierror:
|
|
|
|
# The node container isn't started (yet?)
|
|
|
|
pass
|
2020-10-04 19:31:09 +03:00
|
|
|
{%- endif %}
|
2024-04-16 21:23:05 +03:00
|
|
|
{%- if cookiecutter.windows == 'y' %}
|
|
|
|
# RunServerPlus
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
# This is a custom setting for RunServerPlus to fix reloader issue in Windows docker environment
|
|
|
|
# Werkzeug reloader type [auto, watchdog, or stat]
|
|
|
|
RUNSERVERPLUS_POLLER_RELOADER_TYPE = 'stat'
|
|
|
|
# If you have CPU and IO load issues, you can increase this poller interval e.g) 5
|
|
|
|
RUNSERVERPLUS_POLLER_RELOADER_INTERVAL = 1
|
|
|
|
{%- endif %}
|
2018-03-06 14:28:25 +03:00
|
|
|
{%- endif %}
|
2014-05-25 18:50:13 +04:00
|
|
|
|
2015-04-26 08:08:23 +03:00
|
|
|
# django-extensions
|
|
|
|
# ------------------------------------------------------------------------------
|
2018-03-06 14:28:25 +03:00
|
|
|
# https://django-extensions.readthedocs.io/en/latest/installation_instructions.html#configuration
|
2024-02-13 13:57:53 +03:00
|
|
|
INSTALLED_APPS += ["django_extensions"]
|
2018-03-06 14:28:25 +03:00
|
|
|
{% if cookiecutter.use_celery == 'y' -%}
|
2015-04-26 08:08:23 +03:00
|
|
|
|
2018-03-06 14:28:25 +03:00
|
|
|
# Celery
|
2015-04-25 16:05:33 +03:00
|
|
|
# ------------------------------------------------------------------------------
|
2019-03-02 16:51:30 +03:00
|
|
|
{% if cookiecutter.use_docker == 'n' -%}
|
2022-04-01 19:32:05 +03:00
|
|
|
# https://docs.celeryq.dev/en/stable/userguide/configuration.html#task-always-eager
|
2018-06-21 22:38:48 +03:00
|
|
|
CELERY_TASK_ALWAYS_EAGER = True
|
2019-03-02 16:51:30 +03:00
|
|
|
{%- endif %}
|
2022-04-01 19:32:05 +03:00
|
|
|
# https://docs.celeryq.dev/en/stable/userguide/configuration.html#task-eager-propagates
|
2018-06-21 22:38:48 +03:00
|
|
|
CELERY_TASK_EAGER_PROPAGATES = True
|
2018-03-06 14:28:25 +03:00
|
|
|
|
2023-01-29 15:12:12 +03:00
|
|
|
{%- endif %}
|
|
|
|
{%- if cookiecutter.frontend_pipeline == 'Webpack' %}
|
|
|
|
# django-webpack-loader
|
|
|
|
# ------------------------------------------------------------------------------
|
2024-02-13 13:57:53 +03:00
|
|
|
WEBPACK_LOADER["DEFAULT"]["CACHE"] = not DEBUG
|
2023-01-29 15:12:12 +03:00
|
|
|
|
2018-03-06 14:28:25 +03:00
|
|
|
{%- endif %}
|
|
|
|
# Your stuff...
|
2016-08-31 18:56:25 +03:00
|
|
|
# ------------------------------------------------------------------------------
|