Commit 33307c83 authored by dorothee.kueppers's avatar dorothee.kueppers
Browse files

postgresql for heroku

parent 274c43f6
......@@ -14,9 +14,14 @@ import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import django_heroku
import dj_database_url
import dotenv
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
dotenv_file = os.path.join(BASE_DIR, ".env")
if os.path.isfile(dotenv_file):
dotenv.load_dotenv(dotenv_file)
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/
......@@ -53,6 +58,8 @@ MIDDLEWARE = [
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
]
ROOT_URLCONF = 'oos_2020_todo.urls'
......@@ -80,12 +87,15 @@ WSGI_APPLICATION = 'oos_2020_todo.wsgi.application'
# Database
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# 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)
# Password validation
......@@ -128,6 +138,7 @@ RECURRENCE_USE_TZ = True
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
CRONJOBS = [
('*/1 * * * *', 'todo.cron.email_todays_todos')
......@@ -143,3 +154,5 @@ EMAIL_USE_TLS = True
# Activate Django-Heroku.
django_heroku.settings(locals())
del DATABASES['default']['OPTIONS']['sslmode']
\ No newline at end of file
......@@ -30,6 +30,7 @@ psycopg2==2.8.5
Pygments==2.6.1
pyparsing==2.4.7
python-dateutil==2.8.1
python-dotenv==0.14.0
pytz==2020.1
requests==2.24.0
six==1.15.0
......
......@@ -194,6 +194,7 @@ def sort_todos(todos_late, todos_someday, todos_soon, todos_today, select_id=Non
todos_today.append(recur_todo)
else:
todos_soon.append(recur_todo)
return todos_someday
def get_impressum(request):
......@@ -223,7 +224,7 @@ def get_show_todo(request):
todos_soon = []
todos_late = []
todos_someday = []
sort_todos(todos_late, todos_someday, todos_soon, todos_today)
todos_someday = sort_todos(todos_late, todos_someday, todos_soon, todos_today)
content = {'page_title': 'Deine Aufgaben',
'form': form,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment