settings.py 3.93 KB
Newer Older
dorothee.kueppers's avatar
dorothee.kueppers committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
"""
Django settings for oos_2020_todo project.

Generated by 'django-admin startproject' using Django 3.0.7.

For more information on this file, see
https://docs.djangoproject.com/en/3.0/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.0/ref/settings/
"""

import os

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
dorothee.kueppers's avatar
dorothee.kueppers committed
16
import django_heroku
dorothee.kueppers's avatar
dorothee.kueppers committed
17
18
import dj_database_url
import dotenv
dorothee.kueppers's avatar
dorothee.kueppers committed
19

dorothee.kueppers's avatar
dorothee.kueppers committed
20
21
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

dorothee.kueppers's avatar
dorothee.kueppers committed
22
23
24
dotenv_file = os.path.join(BASE_DIR, ".env")
if os.path.isfile(dotenv_file):
    dotenv.load_dotenv(dotenv_file)
dorothee.kueppers's avatar
dorothee.kueppers committed
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '8f&^^5razouamp=m1-_a+pnd_m+4l5+yspjq2b_9q8v@45+!2!'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []


# Application definition

INSTALLED_APPS = [
dorothee.kueppers's avatar
dorothee.kueppers committed
41
    'django_crontab',
dorothee.kueppers's avatar
dorothee.kueppers committed
42
43
44
45
46
47
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
dorothee.kueppers's avatar
dorothee.kueppers committed
48
    'todo',
49
50
    'bootstrap4',
    'recurrence',
dorothee.kueppers's avatar
dorothee.kueppers committed
51
52
53
54
55
56
57
58
59
60
]

MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
dorothee.kueppers's avatar
dorothee.kueppers committed
61
62
    'whitenoise.middleware.WhiteNoiseMiddleware',

dorothee.kueppers's avatar
dorothee.kueppers committed
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
]

ROOT_URLCONF = 'oos_2020_todo.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, 'templates')]
        ,
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

WSGI_APPLICATION = 'oos_2020_todo.wsgi.application'


# Database
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases

dorothee.kueppers's avatar
dorothee.kueppers committed
90
91
92
93
94
95
96
97
98
# DATABASES = {
#     'default': {
#         'ENGINE': 'django.db.backends.sqlite3',
#         'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
#     }
# }

DATABASES = {}
DATABASES['default'] = dj_database_url.config(conn_max_age=600)
dorothee.kueppers's avatar
dorothee.kueppers committed
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122


# Password validation
# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]


# Internationalization
# https://docs.djangoproject.com/en/3.0/topics/i18n/

dorothee.kueppers's avatar
dorothee.kueppers committed
123
LANGUAGE_CODE = 'de-de'
dorothee.kueppers's avatar
dorothee.kueppers committed
124

dorothee.kueppers's avatar
dorothee.kueppers committed
125
TIME_ZONE = 'Europe/Berlin'
dorothee.kueppers's avatar
dorothee.kueppers committed
126
127
128
129
130
131
132

USE_I18N = True

USE_L10N = True

USE_TZ = True

dorothee.kueppers's avatar
dorothee.kueppers committed
133
134
RECURRENCE_USE_TZ = True

dorothee.kueppers's avatar
dorothee.kueppers committed
135
136
137
138
139

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.0/howto/static-files/

STATIC_URL = '/static/'
140
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
dorothee.kueppers's avatar
dorothee.kueppers committed
141
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
142

143
CRONJOBS = [
dorothee.kueppers's avatar
dorothee.kueppers committed
144
    ('0 8 * * *', 'todo.cron.email_todays_todos')
dorothee.kueppers's avatar
dorothee.kueppers committed
145
146
147
148
149
150
151
152
]


EMAIL_HOST = 'mail.gmx.net'
EMAIL_PORT: 587
EMAIL_HOST_USER: 'feierabend-todo@gmx.de'
EMAIL_HOST_PASSWORD: 'oos_2020_todo'
EMAIL_USE_TLS = True
dorothee.kueppers's avatar
dorothee.kueppers committed
153
154
155

# Activate Django-Heroku.
django_heroku.settings(locals())
dorothee.kueppers's avatar
dorothee.kueppers committed
156

dorothee.kueppers's avatar
dorothee.kueppers committed
157
del DATABASES['default']['OPTIONS']['sslmode']