mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2024-11-22 01:26:57 +03:00
Add support for secure Redis (TLS support) (#5526)
This commit is contained in:
parent
d00cd42e6c
commit
7fc33c2a23
|
@ -14,6 +14,7 @@ Run these commands to deploy the project to Heroku:
|
||||||
|
|
||||||
# Note: this is not a free plan
|
# Note: this is not a free plan
|
||||||
heroku addons:create heroku-postgresql:essential-0
|
heroku addons:create heroku-postgresql:essential-0
|
||||||
|
|
||||||
# On Windows use double quotes for the time zone, e.g.
|
# On Windows use double quotes for the time zone, e.g.
|
||||||
# heroku pg:backups schedule --at "02:00 America/Los_Angeles" DATABASE_URL
|
# heroku pg:backups schedule --at "02:00 America/Los_Angeles" DATABASE_URL
|
||||||
heroku pg:backups schedule --at '02:00 America/Los_Angeles' DATABASE_URL
|
heroku pg:backups schedule --at '02:00 America/Los_Angeles' DATABASE_URL
|
||||||
|
|
6
uv.lock
6
uv.lock
|
@ -181,7 +181,7 @@ wheels = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cookiecutter-django"
|
name = "cookiecutter-django"
|
||||||
version = "2024.10.24"
|
version = "2024.11.20"
|
||||||
source = { virtual = "." }
|
source = { virtual = "." }
|
||||||
dependencies = [
|
dependencies = [
|
||||||
{ name = "binaryornot" },
|
{ name = "binaryornot" },
|
||||||
|
@ -204,7 +204,7 @@ dependencies = [
|
||||||
{ name = "tox-uv" },
|
{ name = "tox-uv" },
|
||||||
]
|
]
|
||||||
|
|
||||||
[package.dependency-groups]
|
[package.dev-dependencies]
|
||||||
docs = [
|
docs = [
|
||||||
{ name = "myst-parser" },
|
{ name = "myst-parser" },
|
||||||
{ name = "sphinx" },
|
{ name = "sphinx" },
|
||||||
|
@ -234,7 +234,7 @@ requires-dist = [
|
||||||
{ name = "tox-uv", specifier = ">=1.11.2" },
|
{ name = "tox-uv", specifier = ">=1.11.2" },
|
||||||
]
|
]
|
||||||
|
|
||||||
[package.metadata.dependency-groups]
|
[package.metadata.requires-dev]
|
||||||
docs = [
|
docs = [
|
||||||
{ name = "myst-parser", specifier = ">=4" },
|
{ name = "myst-parser", specifier = ">=4" },
|
||||||
{ name = "sphinx", specifier = ">=8.0.2" },
|
{ name = "sphinx", specifier = ">=8.0.2" },
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
# ruff: noqa: ERA001, E501
|
# ruff: noqa: ERA001, E501
|
||||||
"""Base settings to build other settings files upon."""
|
"""Base settings to build other settings files upon."""
|
||||||
|
|
||||||
|
{% if cookiecutter.use_celery == 'y' -%}
|
||||||
|
import ssl
|
||||||
|
{%- endif %}
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import environ
|
import environ
|
||||||
|
@ -283,6 +286,7 @@ LOGGING = {
|
||||||
}
|
}
|
||||||
|
|
||||||
REDIS_URL = env("REDIS_URL", default="redis://{% if cookiecutter.use_docker == 'y' %}redis{%else%}localhost{% endif %}:6379/0")
|
REDIS_URL = env("REDIS_URL", default="redis://{% if cookiecutter.use_docker == 'y' %}redis{%else%}localhost{% endif %}:6379/0")
|
||||||
|
REDIS_SSL = REDIS_URL.startswith("rediss://")
|
||||||
|
|
||||||
{% if cookiecutter.use_celery == 'y' -%}
|
{% if cookiecutter.use_celery == 'y' -%}
|
||||||
# Celery
|
# Celery
|
||||||
|
@ -292,8 +296,12 @@ if USE_TZ:
|
||||||
CELERY_TIMEZONE = TIME_ZONE
|
CELERY_TIMEZONE = TIME_ZONE
|
||||||
# https://docs.celeryq.dev/en/stable/userguide/configuration.html#std:setting-broker_url
|
# https://docs.celeryq.dev/en/stable/userguide/configuration.html#std:setting-broker_url
|
||||||
CELERY_BROKER_URL = REDIS_URL
|
CELERY_BROKER_URL = REDIS_URL
|
||||||
|
# https://docs.celeryq.dev/en/stable/userguide/configuration.html#redis-backend-use-ssl
|
||||||
|
CELERY_BROKER_USE_SSL = {"ssl_cert_reqs": ssl.CERT_NONE} if REDIS_SSL else None
|
||||||
# https://docs.celeryq.dev/en/stable/userguide/configuration.html#std:setting-result_backend
|
# https://docs.celeryq.dev/en/stable/userguide/configuration.html#std:setting-result_backend
|
||||||
CELERY_RESULT_BACKEND = REDIS_URL
|
CELERY_RESULT_BACKEND = REDIS_URL
|
||||||
|
# https://docs.celeryq.dev/en/stable/userguide/configuration.html#redis-backend-use-ssl
|
||||||
|
CELERY_REDIS_BACKEND_USE_SSL = CELERY_BROKER_USE_SSL
|
||||||
# https://docs.celeryq.dev/en/stable/userguide/configuration.html#result-extended
|
# https://docs.celeryq.dev/en/stable/userguide/configuration.html#result-extended
|
||||||
CELERY_RESULT_EXTENDED = True
|
CELERY_RESULT_EXTENDED = True
|
||||||
# https://docs.celeryq.dev/en/stable/userguide/configuration.html#result-backend-always-retry
|
# https://docs.celeryq.dev/en/stable/userguide/configuration.html#result-backend-always-retry
|
||||||
|
|
Loading…
Reference in New Issue
Block a user