Add support for secure Redis (TLS support) (#5526)

This commit is contained in:
qwerrrqw 2024-11-21 21:54:50 +09:00 committed by GitHub
parent d00cd42e6c
commit 7fc33c2a23
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 3 deletions

View File

@ -14,6 +14,7 @@ Run these commands to deploy the project to Heroku:
# Note: this is not a free plan
heroku addons:create heroku-postgresql:essential-0
# 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

View File

@ -181,7 +181,7 @@ wheels = [
[[package]]
name = "cookiecutter-django"
version = "2024.10.24"
version = "2024.11.20"
source = { virtual = "." }
dependencies = [
{ name = "binaryornot" },
@ -204,7 +204,7 @@ dependencies = [
{ name = "tox-uv" },
]
[package.dependency-groups]
[package.dev-dependencies]
docs = [
{ name = "myst-parser" },
{ name = "sphinx" },
@ -234,7 +234,7 @@ requires-dist = [
{ name = "tox-uv", specifier = ">=1.11.2" },
]
[package.metadata.dependency-groups]
[package.metadata.requires-dev]
docs = [
{ name = "myst-parser", specifier = ">=4" },
{ name = "sphinx", specifier = ">=8.0.2" },

View File

@ -1,6 +1,9 @@
# ruff: noqa: ERA001, E501
"""Base settings to build other settings files upon."""
{% if cookiecutter.use_celery == 'y' -%}
import ssl
{%- endif %}
from pathlib import Path
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_SSL = REDIS_URL.startswith("rediss://")
{% if cookiecutter.use_celery == 'y' -%}
# Celery
@ -292,8 +296,12 @@ if USE_TZ:
CELERY_TIMEZONE = TIME_ZONE
# https://docs.celeryq.dev/en/stable/userguide/configuration.html#std:setting-broker_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
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
CELERY_RESULT_EXTENDED = True
# https://docs.celeryq.dev/en/stable/userguide/configuration.html#result-backend-always-retry