repos
/ timestrap-django master

timestrap-django

mirror archived upstream

Time tracking you can host anywhere, built on Django. Full export support in multiple formats and easily extensible.

djangodockerhandcodedpythonself-hostedtime-trackingtimetracker

1.3 KB · 56 lines · Python Raw History
 1import dj_database_url
 2
 3from .base import *  # noqa: F401,F403
 4
 5
 6DEBUG = False
 7
 8
 9# SECURITY WARNING: keep the secret key used in production secret!
10
11SECRET_KEY = os.environ["SECRET_KEY"]  # noqa: F405
12
13
14# SECURITY WARNING: set this to your domain name in production!
15
16ALLOWED_HOSTS = ["*"]
17
18# SSL
19
20SECURE_SSL_REDIRECT = True
21SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
22
23
24# Database
25# https://docs.djangoproject.com/en/2.0/ref/settings/#databases
26
27DATABASES = {"default": dj_database_url.config(conn_max_age=500)}
28
29
30# Channels
31# https://channels.readthedocs.io/en/latest/
32
33CHANNEL_LAYERS = {
34    "default": {
35        "BACKEND": "channels_redis.core.RedisChannelLayer",
36        "CONFIG": {"hosts": [os.environ.get("REDIS_URL")]},  # noqa: F405
37    }
38}
39
40
41# Email
42
43SENDGRID_USERNAME = os.environ.get("SENDGRID_USERNAME", None)  # noqa: F405
44SENDGRID_PASSWORD = os.environ.get("SENDGRID_PASSWORD", None)  # noqa: F405
45
46# Use SendGrid if we have the addon installed
47if SENDGRID_USERNAME and SENDGRID_PASSWORD:
48    EMAIL_HOST = "smtp.sendgrid.net"
49    EMAIL_HOST_USER = SENDGRID_USERNAME
50    EMAIL_HOST_PASSWORD = SENDGRID_PASSWORD
51    EMAIL_PORT = 587
52    EMAIL_USE_TLS = True
53else:
54    EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
55    EMAIL_ENABLED = False