From e030fa330dab4dc0f8b44a636ff7e1888f3e5cfc Mon Sep 17 00:00:00 2001 From: Dennis Ahrens <dennis.ahrens@hs-hannover.de> Date: Wed, 21 Sep 2016 11:16:53 +0200 Subject: [PATCH] Change settings structure to match our common one. --- .gitignore | 2 +- helloworld/settings/__init__.py | 5 +++ .../{settings.py => settings/common.py} | 37 ------------------- helloworld/settings/logging.py | 22 +++++++++++ helloworld/settings/private.example.py | 13 +++++++ 5 files changed, 41 insertions(+), 38 deletions(-) create mode 100644 helloworld/settings/__init__.py rename helloworld/{settings.py => settings/common.py} (74%) create mode 100644 helloworld/settings/logging.py create mode 100644 helloworld/settings/private.example.py diff --git a/.gitignore b/.gitignore index 360d274..8b7ba6c 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,4 @@ build/ dist/ venv/ helloworld.db -local_settings.py +helloworld/settings/private.py diff --git a/helloworld/settings/__init__.py b/helloworld/settings/__init__.py new file mode 100644 index 0000000..523517d --- /dev/null +++ b/helloworld/settings/__init__.py @@ -0,0 +1,5 @@ +from helloworld.settings.common import * +from helloworld.settings.logging import * + +# this comes after all other settings (since private settings will override several values) +from helloworld.settings.private import * diff --git a/helloworld/settings.py b/helloworld/settings/common.py similarity index 74% rename from helloworld/settings.py rename to helloworld/settings/common.py index bcc946c..6dba931 100644 --- a/helloworld/settings.py +++ b/helloworld/settings/common.py @@ -9,17 +9,6 @@ ADMINS = ( MANAGERS = ADMINS -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. - 'NAME': 'helloworld.db', # Or path to database file if using sqlite3. - 'USER': '', # Not used with sqlite3. - 'PASSWORD': '', # Not used with sqlite3. - 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. - 'PORT': '', # Set to empty string for default. Not used with sqlite3. - } -} - # Local time zone for this installation. Choices can be found here: # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name # although not all choices may be available on all operating systems. @@ -86,9 +75,6 @@ STATICFILES_FINDERS = ( # 'django.contrib.staticfiles.finders.DefaultStorageFinder', ) -# Make this unique, and don't share it with anybody. -SECRET_KEY = '0h@p1(0e%*b9r4k+dnpc+7s18lpap6+=cu^#^d=hll+38zv_)r' - # List of callables that know how to import templates from various sources. TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.Loader', @@ -125,26 +111,3 @@ INSTALLED_APPS = ( # Uncomment the next line to enable admin documentation: 'django.contrib.admindocs', ) - -# A sample logging configuration. The only tangible logging -# performed by this configuration is to send an email to -# the site admins on every HTTP 500 error. -# See http://docs.djangoproject.com/en/dev/topics/logging for -# more details on how to customize your logging configuration. -LOGGING = { - 'version': 1, - 'disable_existing_loggers': False, - 'handlers': { - 'mail_admins': { - 'level': 'ERROR', - 'class': 'django.utils.log.AdminEmailHandler' - } - }, - 'loggers': { - 'django.request': { - 'handlers': ['mail_admins'], - 'level': 'ERROR', - 'propagate': True, - }, - } -} diff --git a/helloworld/settings/logging.py b/helloworld/settings/logging.py new file mode 100644 index 0000000..8967a25 --- /dev/null +++ b/helloworld/settings/logging.py @@ -0,0 +1,22 @@ +# A sample logging configuration. The only tangible logging +# performed by this configuration is to send an email to +# the site admins on every HTTP 500 error. +# See http://docs.djangoproject.com/en/dev/topics/logging for +# more details on how to customize your logging configuration. +LOGGING = { + 'version': 1, + 'disable_existing_loggers': False, + 'handlers': { + 'mail_admins': { + 'level': 'ERROR', + 'class': 'django.utils.log.AdminEmailHandler' + } + }, + 'loggers': { + 'django.request': { + 'handlers': ['mail_admins'], + 'level': 'ERROR', + 'propagate': True, + }, + } +} diff --git a/helloworld/settings/private.example.py b/helloworld/settings/private.example.py new file mode 100644 index 0000000..db867db --- /dev/null +++ b/helloworld/settings/private.example.py @@ -0,0 +1,13 @@ +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. + 'NAME': 'helloworld.db', # Or path to database file if using sqlite3. + 'USER': '', # Not used with sqlite3. + 'PASSWORD': '', # Not used with sqlite3. + 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. + 'PORT': '', # Set to empty string for default. Not used with sqlite3. + } +} + +# Make this unique, and don't share it with anybody. +SECRET_KEY = '0h@p1(0e%*b9r4k+dnpc+7s18lpap6+=cu^#^d=hll+38zv_)r' -- GitLab