1
0
Fork 0
mirror of https://gitlab.com/bramw/baserow.git synced 2025-04-14 17:18:33 +00:00
bramw_baserow/deploy/heroku/settings.py

36 lines
1.5 KiB
Python

from baserow.config.settings.base import *
import os
import ssl
import dj_database_url
MEDIA_ROOT = "/baserow/media"
FROM_EMAIL = f"no-reply@{os.environ['MAILGUN_DOMAIN']}"
CELERY_EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
EMAIL_USE_TLS = False
EMAIL_HOST = os.environ["MAILGUN_SMTP_SERVER"]
EMAIL_PORT = os.environ["MAILGUN_SMTP_PORT"]
EMAIL_HOST_USER = os.environ["MAILGUN_SMTP_LOGIN"]
EMAIL_HOST_PASSWORD = os.environ["MAILGUN_SMTP_PASSWORD"]
# We need to set the certificate check to None, otherwise it is not compatible with the
# `heroku-redis:hobby-dev` addon. The URL generated by that addon is over a secured
# connection with a self signed certificate. The redis broker could fail if the
# certificate can't be verified.
CELERY_REDBEAT_REDIS_USE_SSL = {"ssl_cert_reqs": ssl.CERT_NONE}
ssl_context = ssl.SSLContext()
ssl_context.verify_mode = ssl.CERT_NONE
CHANNELS_REDIS_HOST = {"address": REDIS_URL, "ssl": ssl_context}
CHANNEL_LAYERS["default"]["CONFIG"]["hosts"] = [CHANNELS_REDIS_HOST]
# Set the limit of the connection pool based on the amount of workers that must be
# started with a limit of 10, which is the default value. This is needed because the
# `heroku-redis:hobby-dev` doesn't accept more than 20 connections.
CELERY_BROKER_POOL_LIMIT = min(4 * int(os.getenv("BASEROW_AMOUNT_OF_WORKERS", "1")), 10)
CELERY_REDIS_MAX_CONNECTIONS = min(
4 * int(os.getenv("BASEROW_AMOUNT_OF_WORKERS", "1")), 10
)
DATABASES = {
"default": dj_database_url.parse(os.environ["DATABASE_URL"], conn_max_age=600)
}