# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1278055102 18000 # Node ID 22d514498935a81349355054e8522887a077da2e # Parent 28a512881850bcdcd2b3682be191b1be3ce1758e Move the configurable parts of settings.py into a conf file diff -r 28a512881850 -r 22d514498935 .hgignore --- a/.hgignore Thu Jul 01 20:14:16 2010 -0500 +++ b/.hgignore Fri Jul 02 02:18:22 2010 -0500 @@ -1,3 +1,4 @@ syntax: glob *.pyc -settings.py +agora.sqlite +agora.conf diff -r 28a512881850 -r 22d514498935 README --- a/README Thu Jul 01 20:14:16 2010 -0500 +++ b/README Fri Jul 02 02:18:22 2010 -0500 @@ -18,8 +18,8 @@ 2) Clone this repository - 3) In the cloned repository, copy "settings-example.py" to - "settings.py" (advanced users: modify this to suit your needs). + 3) In the cloned repository, copy "agora-example.conf" to + "agora.conf" (advanced users: modify this to suit your needs). 4) Now run diff -r 28a512881850 -r 22d514498935 agora-example.conf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/agora-example.conf Fri Jul 02 02:18:22 2010 -0500 @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- + +# this is an example configuration +# the real file should be called 'agora.conf' + + +#You probably want this enabled unless you're running Agora in a +#production environment +[debug] +debug = yes + +#This is used for salting the hashes of users' passwords and other +#hashing algorithms. +[security] +secret_key = l0ng-str1ng-no-one-w1ll-gue55-with-numb3rs-4nd-letters + +#Put the names of admins below as name = email like in the example +[admins] +Jordi Gutiérrez Hermoso = jordigh@gmail.com + +#Database details +[db] +ENGINE = django.db.backends.sqlite3 +NAME = agora.sqlite +## Sample PostgreSQL +# +# ENGINE = django.db.backends.postgresql_psycopg2 +# NAME = django +# USER = django +# PASSWORD = django +# HOST = +# PORT = + +[env] +# see http://en.wikipedia.org/wiki/List_of_tz_zones_by_name for other +# timezones +timezone = America/Mexico_City diff -r 28a512881850 -r 22d514498935 settings-example.py --- a/settings-example.py Thu Jul 01 20:14:16 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,125 +0,0 @@ -# Sample settings.py for Agora Octave -# -*- coding: utf-8 -*- - - -DEBUG = True -TEMPLATE_DEBUG = DEBUG - -ADMINS = ( - ('Jordi Gutiérrez Hermoso', 'jordigh@gmail.com'), -) - -MANAGERS = ADMINS - -DATABASES = { - 'default': { - #Current Postgres setup - - #'ENGINE': 'django.db.backends.postgresql_psycopg2', - #'NAME': 'django', - #'USER': 'django', - #'PASSWORD': 'django', - #'HOST': '', - #'PORT': '', - - #SQLite is enough for testing - 'ENGINE' : 'django.db.backends.sqlite3', - 'NAME': 'agora' - } -} - -# 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/Mexico_City' - -# 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 path to the directory that holds media. -# Example: "/home/media/media.lawrence.com/" -MEDIA_ROOT = 'static/' - -# 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 = 'adfasd12312312asfa123' - -# 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', -) - -ROOT_URLCONF = 'agora.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. - - "templates", #Relative paths are ok for testing -) - -#For how long a registration link will remain active -ACCOUNT_ACTIVATION_DAYS = 1 - -TEMPLATE_CONTEXT_PROCESSORS = ( - "django.core.context_processors.auth", - "django.core.context_processors.debug", - "django.core.context_processors.i18n", - "django.core.context_processors.media", - "django.core.context_processors.request", -) - -INSTALLED_APPS = ( - 'django.contrib.auth', - 'django.contrib.contenttypes', - 'django.contrib.sessions', - 'django.contrib.sites', - 'django.contrib.messages', - 'django.contrib.admindocs', - 'django.contrib.admin', - - #Third-party apps - 'registration', - - #Agora-specific apps - 'agora.apps.snippet', - 'agora.apps.bundle', - 'agora.apps.free_license', -) - -LOGIN_REDIRECT_URL='/' diff -r 28a512881850 -r 22d514498935 settings.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/settings.py Fri Jul 02 02:18:22 2010 -0500 @@ -0,0 +1,146 @@ +# Django settings for agora project. +# -*- coding: utf-8 -*- + +# Read some settings from config file +from ConfigParser import ConfigParser +config = ConfigParser() + +#This makes options in the config case-sensitive +config.optionxform = str + +if not config.read('agora.conf'): + print >> sys.stderr, ''' +ERROR: No config file found! + You probably should copy agora-example.conf to agora.conf +'''; + exit(1) + +try: + DEBUG = (config.get('debug', 'debug').lower() == 'yes') +except: + DEBUG = False + +TEMPLATE_DEBUG = DEBUG + +try: + ADMINS = tuple(config.items('admins')) +except: + ADMINS = () + +MANAGERS = ADMINS + +try: + database = dict(config.items('db')) +except: + database = { 'ENGINE' : 'django.db.backends.sqlite3', + 'NAME' : 'agora',} + +DATABASES = { + 'default': database +} + +try: + tz = config.get('env','timezone') +except: + tz = 'America/Mexico_City' + +# 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 = tz + +# 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 = False + +# If you set this to False, Django will not format dates, numbers and +# calendars according to the current locale +USE_L10N = False + +# Absolute path to the directory that holds media. +# Example: "/home/media/media.lawrence.com/" +MEDIA_ROOT = 'static/' + +# 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/' + +try: + secret_key = config.get('security','secret_key') +except: + secret_key = 'l0ng-str1ng-no-one-w1ll-gue55-with-numb3rs-4nd-letters' + +# Make this unique, and don't share it with anybody. +SECRET_KEY = secret_key + +# 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', +) + +ROOT_URLCONF = 'agora.urls' + +TEMPLATE_DIRS = ( + # Probably should make this an absolute path on an actual + # installation, but on a debug setup relative paths work fine. + "templates", +) + +ACCOUNT_ACTIVATION_DAYS = 1 + +TEMPLATE_CONTEXT_PROCESSORS = ( + "django.core.context_processors.auth", + "django.core.context_processors.debug", + "django.core.context_processors.i18n", + "django.core.context_processors.media", + "django.core.context_processors.request", +) + + +INSTALLED_APPS = ( + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.sites', + 'django.contrib.messages', + 'django.contrib.admindocs', + 'django.contrib.admin', + + #Third-party apps + 'registration', + + #Agora apps + 'agora.apps.profile', + 'agora.apps.snippet', + 'agora.apps.bundle', + 'agora.apps.free_license', +) + +LOGIN_REDIRECT_URL='/' +AUTH_PROFILE_MODULE = 'profile.Profile'