From: Radek Czajka Date: Wed, 8 Aug 2012 13:55:25 +0000 (+0200) Subject: split settings X-Git-Url: https://git.mdrn.pl/prawokultury.git/commitdiff_plain/40d4547a5c9eb12079306c0d683a77d183e8588d?ds=sidebyside split settings --- diff --git a/.gitignore b/.gitignore index c3e3e48..fa1b927 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -localsettings.py +*/settings.d/local.conf dev.sqlite *.db *.db-journal diff --git a/prawokultury/settings.d/10-paths.conf b/prawokultury/settings.d/10-paths.conf new file mode 100755 index 0000000..b3ef304 --- /dev/null +++ b/prawokultury/settings.d/10-paths.conf @@ -0,0 +1,3 @@ +from os import path + +PROJECT_DIR = path.dirname(path.abspath(path.dirname(__file__))) diff --git a/prawokultury/settings.d/20-basic.conf b/prawokultury/settings.d/20-basic.conf new file mode 100755 index 0000000..0d126cc --- /dev/null +++ b/prawokultury/settings.d/20-basic.conf @@ -0,0 +1,33 @@ +DEBUG = False +TEMPLATE_DEBUG = DEBUG + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. + 'NAME': path.join(PROJECT_DIR, 'dev.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. + } +} + +SITE_ID = 1 + +# List of callables that know how to import templates from various sources. +TEMPLATE_LOADERS = ( + 'django.template.loaders.filesystem.Loader', + 'django.template.loaders.app_directories.Loader', +# 'django.template.loaders.eggs.Loader', +) + +ROOT_URLCONF = 'prawokultury.urls' + +# Python dotted path to the WSGI application used by Django's runserver. +WSGI_APPLICATION = 'prawokultury.wsgi.application' + +TEMPLATE_DIRS = ( + # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". + # Always use forward slashes, even on Windows. + # Don't forget to use absolute paths, not relative paths. +) diff --git a/prawokultury/settings.d/30-apps.conf b/prawokultury/settings.d/30-apps.conf new file mode 100755 index 0000000..931cb41 --- /dev/null +++ b/prawokultury/settings.d/30-apps.conf @@ -0,0 +1,20 @@ +INSTALLED_APPS = ( + 'prawokultury', + 'events', + 'migdal', + + 'gravatar', + 'south', + 'django.contrib.comments', + 'django_comments_xtd', + 'pipeline', + + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.sites', + 'django.contrib.messages', + 'django.contrib.staticfiles', + 'django.contrib.admin', + 'django.contrib.admindocs', +) diff --git a/prawokultury/settings.d/30-locale.conf b/prawokultury/settings.d/30-locale.conf new file mode 100755 index 0000000..77c0f12 --- /dev/null +++ b/prawokultury/settings.d/30-locale.conf @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- + +LANGUAGES = ( + ('pl', u'polski'), + ('en', u'English'), +) + +# 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. +# On Unix systems, a value of None will cause Django to use the same +# timezone as the operating system. +# If running in a Windows environment this must be set to the same as your +# system time zone. +TIME_ZONE = None + +# Language code for this installation. All choices can be found here: +# http://www.i18nguy.com/unicode/language-identifiers.html +LANGUAGE_CODE = 'pl' + +# If you set this to False, Django will make some optimizations so as not +# to load the internationalization machinery. +USE_I18N = True + +# If you set this to False, Django will not format dates, numbers and +# calendars according to the current locale. +USE_L10N = True + +# If you set this to False, Django will not use timezone-aware datetimes. +USE_TZ = False diff --git a/prawokultury/settings.d/40-context.conf b/prawokultury/settings.d/40-context.conf new file mode 100755 index 0000000..fe0dd19 --- /dev/null +++ b/prawokultury/settings.d/40-context.conf @@ -0,0 +1,10 @@ +TEMPLATE_CONTEXT_PROCESSORS = ( + "django.contrib.auth.context_processors.auth", + "django.core.context_processors.debug", + "django.core.context_processors.i18n", + "django.core.context_processors.media", + "django.core.context_processors.static", + "django.core.context_processors.tz", + "django.contrib.messages.context_processors.messages", + 'django.core.context_processors.request', +) diff --git a/prawokultury/settings.d/40-logging.conf b/prawokultury/settings.d/40-logging.conf new file mode 100755 index 0000000..3d91c9c --- /dev/null +++ b/prawokultury/settings.d/40-logging.conf @@ -0,0 +1,28 @@ +# 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 when DEBUG=False. +# 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, + 'filters': { + 'require_debug_false': { + '()': 'django.utils.log.RequireDebugFalse' + } + }, + 'handlers': { + 'mail_admins': { + 'level': 'ERROR', + 'filters': ['require_debug_false'], + 'class': 'django.utils.log.AdminEmailHandler' + } + }, + 'loggers': { + 'django.request': { + 'handlers': ['mail_admins'], + 'level': 'ERROR', + 'propagate': True, + }, + } +} diff --git a/prawokultury/settings.d/40-middleware.conf b/prawokultury/settings.d/40-middleware.conf new file mode 100755 index 0000000..72f7e14 --- /dev/null +++ b/prawokultury/settings.d/40-middleware.conf @@ -0,0 +1,12 @@ +MIDDLEWARE_CLASSES = ( + 'django.contrib.sessions.middleware.SessionMiddleware', + #'django.middleware.locale.LocaleMiddleware', + 'migdal.middleware.URLLocaleMiddleware', + + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + # Uncomment the next line for simple clickjacking protection: + # 'django.middleware.clickjacking.XFrameOptionsMiddleware', +) diff --git a/prawokultury/settings.d/50-contrib.conf b/prawokultury/settings.d/50-contrib.conf new file mode 100755 index 0000000..b1874d4 --- /dev/null +++ b/prawokultury/settings.d/50-contrib.conf @@ -0,0 +1,10 @@ +from prawokultury.helpers import textile_pl + +COMMENTS_APP = "django_comments_xtd" +COMMENTS_XTD_CONFIRM_EMAIL = False + +MARKUP_FIELD_TYPES = ( + ('textile_pl', textile_pl), +) +COMMENTS_XTD_LIST_URL_ACTIVE = True +#COMMENTS_XTD_LIST_PAGINATE_BY = 10 diff --git a/prawokultury/settings.d/50-static.conf b/prawokultury/settings.d/50-static.conf new file mode 100755 index 0000000..9eac192 --- /dev/null +++ b/prawokultury/settings.d/50-static.conf @@ -0,0 +1,22 @@ +MEDIA_ROOT = path.join(PROJECT_DIR, 'media/') +MEDIA_URL = '/media/' +STATIC_ROOT = path.join(PROJECT_DIR, 'static/') +STATIC_URL = '/static/' + +STATICFILES_FINDERS = ( + 'django.contrib.staticfiles.finders.FileSystemFinder', + 'django.contrib.staticfiles.finders.AppDirectoriesFinder', +# 'django.contrib.staticfiles.finders.DefaultStorageFinder', +) + +STATICFILES_STORAGE = 'pipeline.storage.PipelineCachedStorage' +PIPELINE_CSS_COMPRESSOR = None +PIPELINE_JS_COMPRESSOR = None +PIPELINE_CSS = { + 'base': { + 'source_filenames': ( + 'css/base.css', + ), + 'output_filename': 'compressed/base.css', + }, +} diff --git a/prawokultury/settings.d/60-custom.conf b/prawokultury/settings.d/60-custom.conf new file mode 100755 index 0000000..e69de29 diff --git a/prawokultury/settings.py b/prawokultury/settings.py index 008b72b..fc41cb4 100644 --- a/prawokultury/settings.py +++ b/prawokultury/settings.py @@ -1,212 +1,7 @@ -# -*- coding: utf-8 -*- -# This file is part of PrawoKultury, licensed under GNU Affero GPLv3 or later. -# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. -# -# Django settings for prawokultury project. - -DEBUG = True -TEMPLATE_DEBUG = DEBUG - -ADMINS = ( - # ('Your Name', 'your_email@example.com'), -) - -MANAGERS = ADMINS - -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. - 'NAME': 'dev.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. -# On Unix systems, a value of None will cause Django to use the same -# timezone as the operating system. -# If running in a Windows environment this must be set to the same as your -# system time zone. -TIME_ZONE = 'America/Chicago' - -# Language code for this installation. All choices can be found here: -# http://www.i18nguy.com/unicode/language-identifiers.html -LANGUAGE_CODE = 'pl' - -SITE_ID = 1 - -# If you set this to False, Django will make some optimizations so as not -# to load the internationalization machinery. -USE_I18N = True - -# If you set this to False, Django will not format dates, numbers and -# calendars according to the current locale. -USE_L10N = True - -# If you set this to False, Django will not use timezone-aware datetimes. -USE_TZ = True - -# Absolute filesystem path to the directory that will hold user-uploaded files. -# Example: "/home/media/media.lawrence.com/media/" -#MEDIA_ROOT = '/home/rczajka/workspace/media/prawokultury/dynamic/' -MEDIA_ROOT = '' - -# URL that handles the media served from MEDIA_ROOT. Make sure to use a -# trailing slash. -# Examples: "http://media.lawrence.com/media/", "http://example.com/media/" -MEDIA_URL = '/media/' - -# Absolute path to the directory static files should be collected to. -# Don't put anything in this directory yourself; store your static files -# in apps' "static/" subdirectories and in STATICFILES_DIRS. -# Example: "/home/media/media.lawrence.com/static/" -STATIC_ROOT = '' - -# URL prefix for static files. -# Example: "http://media.lawrence.com/static/" -STATIC_URL = '/static/' - -# Additional locations of static files -STATICFILES_DIRS = ( - # Put strings here, like "/home/html/static" or "C:/www/django/static". - # Always use forward slashes, even on Windows. - # Don't forget to use absolute paths, not relative paths. -) - -# List of finder classes that know how to find static files in -# various locations. -STATICFILES_FINDERS = ( - 'django.contrib.staticfiles.finders.FileSystemFinder', - 'django.contrib.staticfiles.finders.AppDirectoriesFinder', -# 'django.contrib.staticfiles.finders.DefaultStorageFinder', -) - -# Make this unique, and don't share it with anybody. -SECRET_KEY = 'a7np^jzj9=ed17(w(q%z!@gfpu^e0k$99cmto)yon$e06t(leg' - -# List of callables that know how to import templates from various sources. -TEMPLATE_LOADERS = ( - 'django.template.loaders.filesystem.Loader', - 'django.template.loaders.app_directories.Loader', -# 'django.template.loaders.eggs.Loader', -) - -MIDDLEWARE_CLASSES = ( - 'django.contrib.sessions.middleware.SessionMiddleware', - #'django.middleware.locale.LocaleMiddleware', - 'migdal.middleware.URLLocaleMiddleware', - - 'django.middleware.common.CommonMiddleware', - 'django.middleware.csrf.CsrfViewMiddleware', - 'django.contrib.auth.middleware.AuthenticationMiddleware', - 'django.contrib.messages.middleware.MessageMiddleware', - # Uncomment the next line for simple clickjacking protection: - # 'django.middleware.clickjacking.XFrameOptionsMiddleware', -) - -ROOT_URLCONF = 'prawokultury.urls' - -# Python dotted path to the WSGI application used by Django's runserver. -WSGI_APPLICATION = 'prawokultury.wsgi.application' - -TEMPLATE_DIRS = ( - # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". - # Always use forward slashes, even on Windows. - # Don't forget to use absolute paths, not relative paths. -) - -INSTALLED_APPS = ( - 'prawokultury', - 'events', - 'migdal', - - 'gravatar', - 'south', - 'django.contrib.comments', - 'django_comments_xtd', - 'pipeline', - - 'django.contrib.auth', - 'django.contrib.contenttypes', - 'django.contrib.sessions', - 'django.contrib.sites', - 'django.contrib.messages', - 'django.contrib.staticfiles', - 'django.contrib.admin', - 'django.contrib.admindocs', -) - -COMMENTS_APP = "django_comments_xtd" -COMMENTS_XTD_CONFIRM_EMAIL = False - - -LANGUAGES = ( - ('pl', u'polski'), - ('en', u'English'), -) - - -# 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 when DEBUG=False. -# 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, - 'filters': { - 'require_debug_false': { - '()': 'django.utils.log.RequireDebugFalse' - } - }, - 'handlers': { - 'mail_admins': { - 'level': 'ERROR', - 'filters': ['require_debug_false'], - 'class': 'django.utils.log.AdminEmailHandler' - } - }, - 'loggers': { - 'django.request': { - 'handlers': ['mail_admins'], - 'level': 'ERROR', - 'propagate': True, - }, - } -} - -STATICFILES_STORAGE = 'pipeline.storage.PipelineCachedStorage' -PIPELINE_CSS_COMPRESSOR = None -PIPELINE_JS_COMPRESSOR = None -PIPELINE_CSS = { - 'base': { - 'source_filenames': ( - 'css/base.css', - ), - 'output_filename': 'compressed/base.css', - }, -} - -TEMPLATE_CONTEXT_PROCESSORS = ( - "django.contrib.auth.context_processors.auth", - "django.core.context_processors.debug", - "django.core.context_processors.i18n", - "django.core.context_processors.media", - "django.core.context_processors.static", - "django.core.context_processors.tz", - "django.contrib.messages.context_processors.messages", - 'django.core.context_processors.request', -) - -from prawokultury.helpers import textile_pl -MARKUP_FIELD_TYPES = ( - ('textile_pl', textile_pl), -) -EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' -COMMENTS_XTD_LIST_URL_ACTIVE = True -COMMENTS_XTD_LIST_PAGINATE_BY = 10 +import os.path +import glob +conffiles = glob.glob(os.path.join(os.path.dirname(__file__), 'settings.d', '*.conf')) +conffiles.sort() +for f in conffiles: + execfile(os.path.abspath(f))