added whitenoise to serve static files

This commit is contained in:
Benni Bärmann 2020-11-09 16:04:36 +01:00
parent 3fed406be5
commit c3e0fb250f
4 changed files with 23 additions and 11 deletions

View File

@ -11,9 +11,20 @@ purpose: gather data from intern(WMDE) and extern(volunteers) forms to create a
python 3.8.2
django 3.1.1
django-formtools 2.2
whitenoise 5.2.0
## production setup
cp foerderbarometer/settings_production.py foerderbarometer/settings.py
edit /secrets.json
edit /secrets.json to contain something similar to
{
"DATABASE_PASSWORD": "THIS IS TOP SECRET!"
}
python manage.py collectstatic
add to cron one time a day:
python manage.py sendmails

View File

@ -44,7 +44,9 @@ def get_secret(setting, secrets=secrets):
SECRET_KEY = '*&7p9#_n$@^%0z49s+7jpy@+j1rw_hqh05knyd6y2*!0)r&b6h'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
DEBUG = False
STATIC_ROOT = BASE_DIR / 'staticfiles'
ALLOWED_HOSTS = ['*']
@ -59,14 +61,12 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
# 'django.contrib.sites',
'formtools',
]
# SITE_ID = 1 # needed for contrib.sites
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',

View File

@ -46,6 +46,8 @@ SECRET_KEY = '*&7p9#_n$@^%0z49s+7jpy@+j1rw_hqh05knyd6y2*!0)r&b6h'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
STATIC_ROOT = BASE_DIR / 'staticfiles'
ALLOWED_HOSTS = ['*']
@ -59,14 +61,12 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
# 'django.contrib.sites',
'formtools',
]
# SITE_ID = 1 # needed for contrib.sites
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',

View File

@ -48,7 +48,9 @@ def get_secret(setting, secrets=secrets):
SECRET_KEY = '*&7p9#_n$@^%0z49s+7jpy@+j1rw_hqh05knyd6y2*!0)r&b6h'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
DEBUG = False
STATIC_ROOT = BASE_DIR / 'staticfiles'
ALLOWED_HOSTS = ['*']
@ -63,14 +65,13 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
# 'django.contrib.sites',
'formtools',
]
# SITE_ID = 1 # needed for contrib.sites
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',