commit 390c77303ae15fcae48f70e1970c435b69ebade9
Author: Giorgos Verigakis <verigak@gmail.com>
Date:   Thu Nov 24 18:11:26 2011 +0200

    Split settings into multiple files
    
    Follow the format of synnefo.
    
    Refs #1590

diff --git a/.gitignore b/.gitignore
index 75b8734..03eeb08 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,3 @@
-settings.py
 docs/build
 pithos/data
 *.db
diff --git a/pithos/settings.d/00-apps.conf b/pithos/settings.d/00-apps.conf
new file mode 100644
index 0000000..ad74524
--- /dev/null
+++ b/pithos/settings.d/00-apps.conf
@@ -0,0 +1,26 @@
+# 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',
+)
+
+MIDDLEWARE_CLASSES = (
+    'django.middleware.common.CommonMiddleware',
+    'pithos.middleware.LoggingConfigMiddleware',
+    'pithos.middleware.AuthMiddleware'
+)
+
+ROOT_URLCONF = 'pithos.urls'
+
+TEMPLATE_DIRS = (
+    # Put strings here, like "/home/html/django_templates".
+    # Always use forward slashes, even on Windows.
+    # Don't forget to use absolute paths, not relative paths.
+)
+
+INSTALLED_APPS = (
+    'pithos.api',
+    'pithos.im',
+    'pithos.public',
+    'pithos.ui'
+)
diff --git a/pithos/settings.d/00-deploy.conf b/pithos/settings.d/00-deploy.conf
new file mode 100644
index 0000000..9cfadad
--- /dev/null
+++ b/pithos/settings.d/00-deploy.conf
@@ -0,0 +1,32 @@
+DEBUG = True
+TEMPLATE_DEBUG = DEBUG
+
+TEST = False
+
+# Bypass authentication for user administration.
+BYPASS_ADMIN_AUTH = False
+
+ADMINS = (
+    # ('Your Name', 'your_email@domain.com'),
+)
+
+MANAGERS = ADMINS
+
+# Make this unique, and don't share it with anybody.
+SECRET_KEY = '$j0cdrfm*0sc2j+e@@2f-&3-_@2=^!z#+b-8o4_i10@2%ev7si'
+
+# Address to use for outgoing emails
+DEFAULT_FROM_EMAIL = 'Pithos <no-reply@grnet.gr>'
+DEFAULT_CONTACT_EMAIL = 'support@pithos.grnet.gr'
+
+FEEDBACK_FROM_EMAIL = DEFAULT_FROM_EMAIL
+FEEDBACK_CONTACT_EMAIL = DEFAULT_CONTACT_EMAIL
+
+# Use to log to a file.
+LOGFILE = None
+
+# The server is behind a proxy (apache and gunicorn setup).
+USE_X_FORWARDED_HOST = False
+
+# Set umask (needed for gunicorn setup).
+#os.umask(0077)
diff --git a/pithos/settings.d/00-site.conf b/pithos/settings.d/00-site.conf
new file mode 100644
index 0000000..e0e3cb5
--- /dev/null
+++ b/pithos/settings.d/00-site.conf
@@ -0,0 +1,36 @@
+# 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 = 'UTC'
+
+# Language code for this installation. All choices can be found here:
+# http://www.i18nguy.com/unicode/language-identifiers.html
+LANGUAGE_CODE = 'en-us'
+
+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
+
+# Absolute filesystem path to the directory that will hold user-uploaded files.
+# Example: "/home/media/media.lawrence.com/"
+MEDIA_ROOT = ''
+
+# URL that handles the media served from MEDIA_ROOT. Make sure to use a
+# trailing slash if there is a path component (optional in other cases).
+# Examples: "http://media.lawrence.com", "http://example.com/media/"
+MEDIA_URL = ''
+
+# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
+# trailing slash.
+# Examples: "http://foo.com/media/", "/media/".
+ADMIN_MEDIA_PREFIX = '/media/'
diff --git a/pithos/settings.d/10-backend.conf b/pithos/settings.d/10-backend.conf
new file mode 100644
index 0000000..069d9e5
--- /dev/null
+++ b/pithos/settings.d/10-backend.conf
@@ -0,0 +1,15 @@
+# The backend modules to use and their initilization options.
+
+# SQLite.
+#BACKEND_DB_MODULE = 'pithos.backends.lib.sqlite'
+#BACKEND_DB_CONNECTION = join(PROJECT_PATH, 'backend.db')
+
+# SQLAlchemy (choose SQLite/MySQL/PostgreSQL).
+BACKEND_DB_MODULE = 'pithos.backends.lib.sqlalchemy'
+BACKEND_DB_CONNECTION = 'sqlite:///' + join(PROJECT_PATH, 'backend.db')
+#BACKEND_DB_CONNECTION = 'mysql://user:pass@host/db'
+#BACKEND_DB_CONNECTION = 'postgresql://user:pass@host/db'
+
+# Block storage.
+BACKEND_BLOCK_MODULE = 'pithos.backends.lib.hashfiler'
+BACKEND_BLOCK_PATH = join(PROJECT_PATH, 'data/')
diff --git a/pithos/settings.d/10-database.conf b/pithos/settings.d/10-database.conf
new file mode 100644
index 0000000..5d2cb59
--- /dev/null
+++ b/pithos/settings.d/10-database.conf
@@ -0,0 +1,6 @@
+DATABASES = {
+    'default': {
+        'ENGINE': 'django.db.backends.sqlite3',
+        'NAME': join(PROJECT_PATH, 'pithos.db')
+    }
+}
diff --git a/pithos/settings.d/20-api.conf b/pithos/settings.d/20-api.conf
new file mode 100644
index 0000000..0765cc1
--- /dev/null
+++ b/pithos/settings.d/20-api.conf
@@ -0,0 +1,3 @@
+# Default setting for new accounts.
+DEFAULT_QUOTA = 50 * 1024 * 1024 * 1024
+DEFAULT_VERSIONING = 'auto'
diff --git a/pithos/settings.d/20-im.conf b/pithos/settings.d/20-im.conf
new file mode 100644
index 0000000..eb90ba6
--- /dev/null
+++ b/pithos/settings.d/20-im.conf
@@ -0,0 +1,33 @@
+# Set the expiration time of newly created auth tokens
+# to be this many hours after their creation time.
+AUTH_TOKEN_DURATION = 30 * 24
+
+# Authenticate via Twitter.
+TWITTER_KEY = ''
+TWITTER_SECRET = ''
+
+INVITATIONS_PER_LEVEL = {
+    0   :   100,
+    1   :   2,
+    2   :   0,
+    3   :   0,
+    4   :   0
+}
+
+SERVICE_NAME = 'Pithos'
+
+# Where users should login with their invitation code
+INVITATION_LOGIN_TARGET = '%s/im/login/invitation?code=%d&next=%s'
+
+# Where users should activate their local account
+ACTIVATION_LOGIN_TARGET = '%s/im/local/activate/?auth=%s&next=%s'
+
+# Where users should reset their local password
+PASSWORD_RESET_TARGET = '%s/im/local/reset/?username=%s&next=%s'
+
+# Identity Management enabled modules
+IM_STANDARD_MODULES = ['local', 'invitation']
+IM_OTHER_MODULES = ['twitter', 'shibboleth']
+
+# Force user profile verification
+FORCE_PROFILE_UPDATE = False
diff --git a/pithos/settings.d/30-admin.conf b/pithos/settings.d/30-admin.conf
new file mode 100644
index 0000000..cb425f6
--- /dev/null
+++ b/pithos/settings.d/30-admin.conf
@@ -0,0 +1,2 @@
+# Show these many users per page in admin interface.
+ADMIN_PAGE_LIMIT = 100
diff --git a/pithos/settings.py b/pithos/settings.py
new file mode 100644
index 0000000..420fb2b
--- /dev/null
+++ b/pithos/settings.py
@@ -0,0 +1,44 @@
+# Copyright 2011 GRNET S.A. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or
+# without modification, are permitted provided that the following
+# conditions are met:
+#
+#   1. Redistributions of source code must retain the above
+#      copyright notice, this list of conditions and the following
+#      disclaimer.
+#
+#   2. Redistributions in binary form must reproduce the above
+#      copyright notice, this list of conditions and the following
+#      disclaimer in the documentation and/or other materials
+#      provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
+# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# The views and conclusions contained in the software and
+# documentation are those of the authors and should not be
+# interpreted as representing official policies, either expressed
+# or implied, of GRNET S.A.
+
+from glob import glob
+from os.path import abspath, dirname, join
+
+
+PROJECT_PATH = dirname(abspath(__file__))
+
+
+conffiles = glob(join(PROJECT_PATH, 'settings.d', '*.conf'))
+
+for conf in sorted(conffiles):
+    execfile(conf)
diff --git a/pithos/settings.py.dist b/pithos/settings.py.dist
deleted file mode 100644
index 0cc86fe..0000000
--- a/pithos/settings.py.dist
+++ /dev/null
@@ -1,221 +0,0 @@
-# Copyright 2011 GRNET S.A. All rights reserved.
-# 
-# Redistribution and use in source and binary forms, with or
-# without modification, are permitted provided that the following
-# conditions are met:
-# 
-#   1. Redistributions of source code must retain the above
-#      copyright notice, this list of conditions and the following
-#      disclaimer.
-# 
-#   2. Redistributions in binary form must reproduce the above
-#      copyright notice, this list of conditions and the following
-#      disclaimer in the documentation and/or other materials
-#      provided with the distribution.
-# 
-# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
-# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-# 
-# The views and conclusions contained in the software and
-# documentation are those of the authors and should not be
-# interpreted as representing official policies, either expressed
-# or implied, of GRNET S.A.
-
-# Django settings for pithos project.
-import os
-
-PROJECT_PATH = os.path.dirname(os.path.abspath(__file__)) + '/'
-
-DEBUG = True
-TEMPLATE_DEBUG = DEBUG
-
-TEST = False
-
-ADMINS = (
-    # ('Your Name', 'your_email@domain.com'),
-)
-
-MANAGERS = ADMINS
-
-DATABASES = {
-    'default': {
-        'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
-        'NAME': PROJECT_PATH + 'pithos.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.
-    }
-}
-
-# The backend modules to use and their initilization options.
-
-# SQLite.
-#BACKEND_DB_MODULE = 'pithos.backends.lib.sqlite'
-#BACKEND_DB_CONNECTION = os.path.join(PROJECT_PATH, 'backend.db')
-
-# SQLAlchemy (choose SQLite/MySQL/PostgreSQL).
-BACKEND_DB_MODULE = 'pithos.backends.lib.sqlalchemy'
-BACKEND_DB_CONNECTION = 'sqlite:///' + os.path.join(PROJECT_PATH, 'backend.db')
-#BACKEND_DB_CONNECTION = 'mysql://user:pass@host/db'
-#BACKEND_DB_CONNECTION = 'postgresql://user:pass@host/db'
-
-# Block storage.
-BACKEND_BLOCK_MODULE = 'pithos.backends.lib.hashfiler'
-BACKEND_BLOCK_PATH = os.path.join(PROJECT_PATH, 'data/')
-
-# Bypass authentication for user administration.
-BYPASS_ADMIN_AUTH = False
-
-# 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 = 'UTC'
-
-# Language code for this installation. All choices can be found here:
-# http://www.i18nguy.com/unicode/language-identifiers.html
-LANGUAGE_CODE = 'en-us'
-
-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
-
-# Absolute filesystem path to the directory that will hold user-uploaded files.
-# Example: "/home/media/media.lawrence.com/"
-MEDIA_ROOT = ''
-
-# URL that handles the media served from MEDIA_ROOT. Make sure to use a
-# trailing slash if there is a path component (optional in other cases).
-# Examples: "http://media.lawrence.com", "http://example.com/media/"
-MEDIA_URL = ''
-
-# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
-# trailing slash.
-# Examples: "http://foo.com/media/", "/media/".
-ADMIN_MEDIA_PREFIX = '/media/'
-
-# Make this unique, and don't share it with anybody.
-SECRET_KEY = '$j0cdrfm*0sc2j+e@@2f-&3-_@2=^!z#+b-8o4_i10@2%ev7si'
-
-# 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.middleware.common.CommonMiddleware',
-#    'django.contrib.sessions.middleware.SessionMiddleware',
-#    'django.middleware.csrf.CsrfViewMiddleware',
-#    'django.contrib.auth.middleware.AuthenticationMiddleware',
-#    'django.contrib.messages.middleware.MessageMiddleware',
-    'pithos.middleware.URLEncodedHeadersMiddleware',
-    'pithos.middleware.LoggingConfigMiddleware',
-    'pithos.middleware.AuthMiddleware'
-)
-
-ROOT_URLCONF = 'pithos.urls'
-
-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 = (
-#    'django.contrib.auth',
-#    'django.contrib.contenttypes',
-#    'django.contrib.sessions',
-#    'django.contrib.sites',
-#    'django.contrib.messages',
-#    'django.contrib.admin',
-#    'django.contrib.admindocs',
-    'pithos.im',
-    'pithos.api',
-    'pithos.ui',
-    'south'
-)
-
-# Set the expiration time of newly created auth tokens
-# to be this many hours after their creation time.
-AUTH_TOKEN_DURATION = 30 * 24
-
-# Default setting for new accounts.
-DEFAULT_QUOTA = 50 * 1024 * 1024 * 1024
-DEFAULT_VERSIONING = 'auto'
-
-# Show these many users per page in admin interface.
-ADMIN_PAGE_LIMIT = 100
-
-# Authenticate via Twitter.
-TWITTER_KEY = ''
-TWITTER_SECRET = ''
-
-# Address to use for outgoing emails
-DEFAULT_FROM_EMAIL = 'Pithos <no-reply@grnet.gr>'
-DEFAULT_CONTACT_EMAIL = 'support@pithos.grnet.gr'
-
-FEEDBACK_FROM_EMAIL = DEFAULT_FROM_EMAIL
-FEEDBACK_CONTACT_EMAIL = DEFAULT_CONTACT_EMAIL
-
-INVITATIONS_PER_LEVEL = {
-    0   :   100,
-    1   :   2,
-    2   :   0,
-    3   :   0,
-    4   :   0
-}
-
-SERVICE_NAME = 'Pithos'
-
-# Where users should login with their invitation code
-INVITATION_LOGIN_TARGET = '%s/im/login/invitation' \
-                            '?code=%d' \
-                            '&next=%s'
-
-# Where users should activate their local account
-ACTIVATION_LOGIN_TARGET = '%s/im/local/activate/' \
-                            '?auth=%s' \
-                            '&next=%s'
-
-# Where users should reset their local password
-PASSWORD_RESET_TARGET = '%s/im/local/reset/' \
-                            '?username=%s' \
-                            '&next=%s'
-
-# Force user profile verification
-FORCE_PROFILE_UPDATE = False
-
-# The server is behind a proy (apache and gunicorn setup).
-USE_X_FORWARDED_HOST = False
-
-# Set umask (needed for gunicorn setup).
-#os.umask(0077)
-
-# Use to log to a file.
-LOGFILE = None
-
-# Identity Management enabled modules
-IM_STANDARD_MODULES = ['local', 'invitation']
-IM_OTHER_MODULES = ['twitter', 'shibboleth']
