2017-10-23 08:49:10 +00:00
|
|
|
import dj_database_url
|
|
|
|
|
2017-12-01 03:39:21 +00:00
|
|
|
from .base import *
|
2017-10-23 08:49:10 +00:00
|
|
|
|
2020-02-04 19:28:16 +00:00
|
|
|
# Default to not allow uploads.
|
|
|
|
# Heroku does not support file storage for this functionality.
|
2017-10-23 08:49:10 +00:00
|
|
|
|
2022-02-10 00:00:30 +00:00
|
|
|
BABY_BUDDY["ALLOW_UPLOADS"] = bool(
|
|
|
|
strtobool(os.environ.get("ALLOW_UPLOADS") or "False")
|
|
|
|
)
|
2017-10-23 08:49:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Database
|
2022-02-21 23:39:38 +00:00
|
|
|
# https://docs.djangoproject.com/en/4.0/ref/settings/#databases
|
2017-10-23 08:49:10 +00:00
|
|
|
|
2022-02-10 00:00:30 +00:00
|
|
|
DATABASES = {"default": dj_database_url.config(conn_max_age=500)}
|
2017-10-23 08:49:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Email
|
2022-02-21 23:39:38 +00:00
|
|
|
# https://docs.djangoproject.com/en/4.0/topics/email/
|
2020-01-19 16:49:45 +00:00
|
|
|
# https://devcenter.heroku.com/articles/sendgrid#python
|
2017-10-23 08:49:10 +00:00
|
|
|
|
2022-02-10 00:00:30 +00:00
|
|
|
SENDGRID_USERNAME = os.environ.get("SENDGRID_USERNAME", None) # noqa: F405
|
|
|
|
SENDGRID_PASSWORD = os.environ.get("SENDGRID_PASSWORD", None) # noqa: F405
|
2017-10-23 08:49:10 +00:00
|
|
|
|
|
|
|
# Use SendGrid if we have the addon installed, else just print to console which
|
|
|
|
# is accessible via Heroku logs
|
|
|
|
if SENDGRID_USERNAME and SENDGRID_PASSWORD:
|
2022-02-10 00:00:30 +00:00
|
|
|
EMAIL_HOST = "smtp.sendgrid.net"
|
2017-10-23 08:49:10 +00:00
|
|
|
EMAIL_HOST_USER = SENDGRID_USERNAME
|
|
|
|
EMAIL_HOST_PASSWORD = SENDGRID_PASSWORD
|
|
|
|
EMAIL_PORT = 587
|
|
|
|
EMAIL_USE_TLS = True
|
|
|
|
EMAIL_TIMEOUT = 60
|