From 9669d10e309b9e155a9ee364afabe7769668c252 Mon Sep 17 00:00:00 2001 From: Benni Baermann Date: Thu, 18 Mar 2021 13:49:14 +0100 Subject: [PATCH] reorganisation of settings/git for production --- .gitignore | 7 + eva/{settings.py => settings_development.py} | 0 eva/settings_production.py | 127 +++++++++++++++++++ 3 files changed, 134 insertions(+) rename eva/{settings.py => settings_development.py} (100%) create mode 100644 eva/settings_production.py diff --git a/.gitignore b/.gitignore index f59d43f..791ffdd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,10 @@ +# secret passwords and so +/secrets.json +/staticfiles +/eva/settings.py +/nohup.out +/logfile + *~ # ---> Python diff --git a/eva/settings.py b/eva/settings_development.py similarity index 100% rename from eva/settings.py rename to eva/settings_development.py diff --git a/eva/settings_production.py b/eva/settings_production.py new file mode 100644 index 0000000..c2de6d1 --- /dev/null +++ b/eva/settings_production.py @@ -0,0 +1,127 @@ +""" +Django settings for eva project. + +Generated by 'django-admin startproject' using Django 3.1.4. + +For more information on this file, see +https://docs.djangoproject.com/en/3.1/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/3.1/ref/settings/ +""" + +from pathlib import Path + +# Build paths inside the project like this: BASE_DIR / 'subdir'. +BASE_DIR = Path(__file__).resolve().parent.parent + +# mails in development go to stdout +EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'g%+i6+gkwt3zz@+k-5x1dtstuw4)&qd$lxd^bt2oswy5e1#dul' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +STATIC_ROOT = BASE_DIR / 'staticfiles' + +ALLOWED_HOSTS = ['*'] + + +# Application definition + +INSTALLED_APPS = [ + 'evapp.apps.EvappConfig', + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + 'multiselectfield', + 'formtools', +] + +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', +] + +ROOT_URLCONF = 'eva.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [], + '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 = 'eva.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/3.1/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': BASE_DIR / 'db.sqlite3', + } +} + + +# Password validation +# https://docs.djangoproject.com/en/3.1/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.1/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_L10N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/3.1/howto/static-files/ + +STATIC_URL = '/static/'