Commits

Hynek Cernoch  committed d4b88b6

Updated test-project to typical Django 1.4 project structure and settings.

Moved from livesettings/test_app to test-project.

  • Participants
  • Parent commits 8e3d9f8

Comments (0)

Files changed (21)

File docs/installation.rst

 ------------
 
  * `Python`_ 2.5 or higher
- * `Django`_ 1.2.3 or higher
+ * `Django`_ 1.4.x or 1.5.x
  * `Django-Keyedcache`_
 
 .. Note 
         ...
     )
 
+It is high recommended to configure a global cache (like `MemcachedCache`) for
+multiprocess servers! Otherwise the processes would not be notified about new
+values with the default `LocMemCache`. The default configuration is safe for
+a debug server (manage.py runserver).
+
+
 Add it to your :file:`urls.py`::
 
     urlpatterns = patterns('',

File livesettings/test_app/__init__.py

-# This directory is an example project.
-# Nothing from here is required if you customize your own project according the documentation.

File livesettings/test_app/localsite/__init__.py

Empty file removed.

File livesettings/test_app/localsite/config.py

-"Examples for livesettings" 
-from livesettings.values import *
-from livesettings import config_register, config_register_list
-from django.utils.translation import ugettext_lazy as _
-
-# Default values should be specified explicitely, otherwise it would be
-# an error if nothing is saved in the database and no default is found.
-
-# First, setup a group to hold all our possible configs
-MYAPP_GROUP = ConfigurationGroup('MyApp', _('My App Settings'), ordering=0)
-
-# Now, add our number of images to display value
-# If a user doesn't enter a value, default to 5
-config_register(PositiveIntegerValue(
-    MYAPP_GROUP,
-        'NUM_IMAGES',
-        description = _('Number of images to display'),
-        help_text = _("How many images to display on front page."),
-        # if no help_hext is given, Default falue is displayed
-        default = 5
-    ))
-
-# Another example of allowing the user to select from several values
-config_register(MultipleStringValue(
-        MYAPP_GROUP,
-        'MEASUREMENT_SYSTEM',
-        description=_("Measurement System"),
-        help_text=_("Default measurement system to use."),
-        choices=[('metric',_('Metric')),
-                    ('imperial',_('Imperial'))],
-        default="imperial"
-    ))
-
-# Because we did not used "ordering" for values, all inputs are sorted alphabetically by name
-
-
-
-# Example group for different boxes
-
-from decimal import Decimal
-
-_ = lambda x: x  # example of dummy international translation function
-
-
-GR1_BOX = ConfigurationGroup('gr_box', _('Example of different boxes'), ordering=1)
-
-config_register_list(
-
-    # Texbox - string or many other types
-    StringValue( GR1_BOX, 'my_StringValue', description='Textbox', ordering=1, default='Orange',
-        help_text='StringValue and many different types looks similar'),
-
-    # Textarea - LongStringValue can be longer then 255 characters
-    LongStringValue( GR1_BOX, 'my_LongStringValue', description='Textarea', ordering=2, default='something',
-        help_text='Long String value'),
-
-    # Checkbox - Boolean
-    BooleanValue( GR1_BOX, 'my_BooleanValue', description='Check box',  ordering=3, default=True,
-        help_text='Boolean value'),
-
-    # Combobox - String value with choices
-    StringValue( GR1_BOX, 'my_StringValue_combobox', description='Combobox', ordering=4,
-         help_text='String value with choices',
-         default=u'AUTO',
-         choices=(('ELEPHANT', _('Elephant')), ('ANT', _('Ant')), ('AUTO', _('Autodetect')),)),
-
-    # Listbox with multiple selection - MultipleStringValue with choices
-    MultipleStringValue( GR1_BOX, 'my_MultipleStringValue', 
-        description='Listbox - e.g. Required Fields', ordering=5, help_text='MultipleStringValue with choices',
-        default=['email', 'first_name'],
-        choices=(
-            ('email', _("Email")),
-            ('title', _("Title")),
-            ('first_name', _("First name")),
-            ('last_name', _("Last name")),
-        )),
-
-    # Password displayed like '****'.
-    PasswordValue( GR1_BOX, 'my_PasswordValue', description='Password value', ordering=6,
-        default='only to see *** now', render_value=True),
-    # If render_value=True (default) the widget will be pre-filled with an actual password value displayed like "****".
-    # If render_value=False, the password field is not pre-filled with any value
-    # and an actual value can be removed by writing space to the field (which is converted to empty string).
-
-)
-
-
-# Examples of other types
-
-GR_MORE = ConfigurationGroup('gr_more', _('More examples'), ordering=2)
-
-config_register_list(
-
-    IntegerValue( GR_MORE, 'my_IntegerValue', description='Integer value', ordering=1, default=-12),
-    # Input values are converted to int type.
-
-    PositiveIntegerValue( GR_MORE, 'my_PositiveIntegerValue', description='Positive integer value',
-        ordering=2, default=13),
-    # PositiveIntegerValue(...) is the same as IntegerValue(..., mini_value=0) 
-
-    DecimalValue( GR_MORE, 'my_DecimalValue', description='Decimal value', ordering=3,
-        default=Decimal('1.2300')),
-    # Input values are converted to type decimal.Decimal
-    # Possible default values are e.g. '4', '4.0', Decimal('4.0'), 4, etc.
-
-    DurationValue( GR_MORE, 'my_DurationValue', description='Duration value',
-        help_text='datetime type, input in second', ordering=4, default=25 * 3600.0),
-    # Input value in seconds is converted to type datetime.timedelta
-
-    FloatValue( GR_MORE, 'my_FloatValue', description='Float value', ordering=5,
-        default=3.14),
-    # Input values are converted to type float.
-
-    LongMultipleStringValue( GR_MORE, 'my_LongMultipleStringValue',
-        description='Long Multiple String Value with choices',  ordering=6,
-        default=['blablabla_b', 'blablabla_c'],
-        choices= tuple(('blablabla_' + x, 15 * x) for x in 'abcdefghijklmnopqrstuvwxyz'),
-        # This example requires storage in long string if all options are selected.
-        ),
-    # Combined Long and Multiple StringValue
-)
-
-
-# Example of enabling modules which have own settings groups in different files
-
-GR_MOD_FLYING = ConfigurationGroup('FLYING', 
-        _('Examples for modules - enabling subsettings of modules for... e.g. Flying :-)'), ordering=3)
-
-# Every module can have its own set of specific live settings, which are enabled/disabled together with a module.
-
-FLYING_MODULES = MultipleStringValue( GR_MOD_FLYING, 'MODULES',
-        description=_('Modules for Flying'),
-        choices=(('calendar', 'calendar'),),
-        default=['calendar',],
-        help_hext='Try to enable/disable these modules and save to see a more os less dependent settings',
-    )
-
-config_register_list(
-    FLYING_MODULES,
-
-    StringValue(GR_MOD_FLYING, 'first_day', description='Calendar - First day of week', default='Monday',
-        ordering=1,
-        choices=zip(* 2 * (('Sunday', 'Monday'),)),
-        requires=FLYING_MODULES,
-        requiresvalue='calendar',
-    )
-
-)
-
-# ==== This part is usually located in a separate file control.py in optional's module directory
-
-from decimal import Decimal
-from django.utils.translation import ugettext_lazy as _
-from livesettings import *
-
-FLYING_MODULES = config_get('FLYING', 'MODULES')
-FLYING_MODULES.add_choice(('django.contrib.webdesign.lorem_ipsum', 'Lorem Ipsum'))
-
-LOREM_GROUP = ConfigurationGroup('django.contrib.webdesign.lorem_ipsum',
-    _('Lorem Ipsum Settings'),
-    requires = FLYING_MODULES,
-    requiresvalue='django.contrib.webdesign.lorem_ipsum',
-    ordering = 101)
-
-config_register_list(
-    ModuleValue(LOREM_GROUP, 'MODULE', default='django.contrib.webdesign.lorem_ipsum', hidden=True),
-
-    MultipleStringValue(LOREM_GROUP, 'lorem_words', description='Lorem ipsum words',
-        choices= zip(* 2 * ('lorem ipsum dolor sit amet'.split(),))
-    )
-)
-
-# More examples for modules in "https://bitbucket.org/chris1610/satchmo/src/tip/satchmo/apps/payment/modules/"

File livesettings/test_app/localsite/models.py

-import config

File livesettings/test_app/localsite/templates/myapp/index.html

-<html><body>
-<pre>
-<p>Measurement system: {{ measurement_system }}</p>
-<p>Image count: {{ image_count }}</p>
-<p><a href="{% url satchmo_site_settings %}">Values can be modified</a> if the user has sufficient permissions (livesettings_setting:change).</p>
-</body></html>

File livesettings/test_app/localsite/views.py

-from django.shortcuts import render_to_response
-from livesettings import config_value
-
-def index(request):
-    image_count = config_value('MyApp','NUM_IMAGES')
-    # Note, the measurement_system will return a list of selected values
-    # in this case, we use the first one
-    measurement_system = config_value('MyApp','MEASUREMENT_SYSTEM')
-    return render_to_response('myapp/index.html',
-                            {'image_count': image_count,
-                            'measurement_system': measurement_system[0]})

File livesettings/test_app/manage.py

-#!/usr/bin/env python
-import os.path
-import sys
-
-DIRNAME = os.path.dirname(__file__)
-
-if not DIRNAME in sys.path:
-    sys.path.append(DIRNAME)
-
-from django.core.management import execute_manager
-try:
-    import settings # Assumed to be in the same directory.
-except ImportError:
-    import sys
-    sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__)
-    sys.exit(1)
-
-if __name__ == "__main__":
-    execute_manager(settings)

File livesettings/test_app/settings.py

-# Django settings.
-# If you have an existing project, then ensure that you modify local_settings-customize.py
-# and import it from your main settings file. (from local_settings import *)
-import os
-
-DIRNAME = os.path.dirname(__file__)
-
-DJANGO_PROJECT = 'test_app'
-DJANGO_SETTINGS_MODULE = 'test_app.settings'
-
-ADMINS = (
-     ('', ''),
-)
-
-MANAGERS = ADMINS
-
-DATABASES = {
-    'default': {
-        'ENGINE': 'django.db.backends.sqlite3',  # 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'ado_mssql'.
-        'NAME': 'test.db',
-    }
-}
-
-# Local time zone for this installation. All choices can be found here:
-# http://www.postgresql.org/docs/current/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE
-TIME_ZONE = 'US/Pacific'
-
-# Language code for this installation. All choices can be found here:
-# http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes
-# http://blogs.law.harvard.edu/tech/stories/storyReader$15
-LANGUAGE_CODE = 'en-us'
-
-SITE_ID = 1
-
-# Absolute path to the directory that holds media.
-# Example: "/home/media/media.lawrence.com/"
-#Image files will be stored off of this path
-MEDIA_ROOT = os.path.join(DIRNAME, 'static/')
-#MEDIA_ROOT = "/static"
-# URL that handles the media served from MEDIA_ROOT.
-# Example: "http://media.lawrence.com"
-#MEDIA_URL = 'site_media'
-MEDIA_URL="/static/"
-# 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 = ''
-
-# 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",  # views in livesettings have enabled CSRF regardless of this setting
-    "django.middleware.locale.LocaleMiddleware",
-    "django.contrib.auth.middleware.AuthenticationMiddleware",
-    "django.contrib.messages.middleware.MessageMiddleware",
-    "django.middleware.doc.XViewMiddleware",
-    #'debug_toolbar.middleware.DebugToolbarMiddleware',
-)
-
-TEMPLATE_CONTEXT_PROCESSORS = ('django.contrib.auth.context_processors.auth',)
-
-ROOT_URLCONF = 'test_app.urls'
-
-INSTALLED_APPS = (
-    'django.contrib.sites',
-    'django.contrib.admin',
-    'django.contrib.auth',
-    'django.contrib.contenttypes',
-    'django.contrib.comments',
-    'django.contrib.flatpages',
-    'django.contrib.sessions',
-    'django.contrib.sitemaps',
-    'livesettings',
-    'keyedcache',
-    'test_app.localsite',
-)
-
-AUTHENTICATION_BACKENDS = (
-    'django.contrib.auth.backends.ModelBackend',
-)
-
-DEBUG_TOOLBAR_CONFIG = {
-   'INTERCEPT_REDIRECTS' : False,
-}
-
-CACHE_PREFIX = 'T'
-CACHE_TIMEOUT = 300
-# If you use logging with the level DEBUG in your application, prevent increasing
-# of logging level of keyedcache by uncommenting the following:
-#import logging
-#logging.getLogger('keyedcache').setLevel(logging.INFO)
-DEBUG = True

File livesettings/test_app/urls.py

-from django.conf.urls import *
-# Imported '*' because Django 1.2 requires importing handler404+500 in the main
-# urls or have customized their templates. Django 1.3 does not require it.
-from django.contrib import admin
-
-admin.autodiscover()
-
-urlpatterns = patterns('',
-    (r'^settings/', include('livesettings.urls')),
-    (r'^admin/', include(admin.site.urls)),
-    (r'^accounts/login/', 'django.contrib.auth.views.login', {'template_name': 'admin/login.html'}),
-    (r'^$', 'localsite.views.index')
-)

File test-project/localsite/__init__.py

Empty file added.

File test-project/localsite/config.py

+"Examples for livesettings" 
+from livesettings.values import *
+from livesettings import config_register, config_register_list
+from django.utils.translation import ugettext_lazy as _
+
+# Default values should be specified explicitely, otherwise it would be
+# an error if nothing is saved in the database and no default is found.
+
+# First, setup a group to hold all our possible configs
+MYAPP_GROUP = ConfigurationGroup('MyApp', _('My App Settings'), ordering=0)
+
+# Now, add our number of images to display value
+# If a user doesn't enter a value, default to 5
+config_register(PositiveIntegerValue(
+    MYAPP_GROUP,
+        'NUM_IMAGES',
+        description = _('Number of images to display'),
+        help_text = _("How many images to display on front page."),
+        # if no help_hext is given, Default falue is displayed
+        default = 5
+    ))
+
+# Another example of allowing the user to select from several values
+config_register(MultipleStringValue(
+        MYAPP_GROUP,
+        'MEASUREMENT_SYSTEM',
+        description=_("Measurement System"),
+        help_text=_("Default measurement system to use."),
+        choices=[('metric',_('Metric')),
+                    ('imperial',_('Imperial'))],
+        default="imperial"
+    ))
+
+# Because we did not used "ordering" for values, all inputs are sorted alphabetically by name
+
+
+
+# Example group for different boxes
+
+from decimal import Decimal
+
+_ = lambda x: x  # example of dummy international translation function
+
+
+GR1_BOX = ConfigurationGroup('gr_box', _('Example of different boxes'), ordering=1)
+
+config_register_list(
+
+    # Texbox - string or many other types
+    StringValue( GR1_BOX, 'my_StringValue', description='Textbox', ordering=1, default='Orange',
+        help_text='StringValue and many different types looks similar'),
+
+    # Textarea - LongStringValue can be longer then 255 characters
+    LongStringValue( GR1_BOX, 'my_LongStringValue', description='Textarea', ordering=2, default='something',
+        help_text='Long String value'),
+
+    # Checkbox - Boolean
+    BooleanValue( GR1_BOX, 'my_BooleanValue', description='Check box',  ordering=3, default=True,
+        help_text='Boolean value'),
+
+    # Combobox - String value with choices
+    StringValue( GR1_BOX, 'my_StringValue_combobox', description='Combobox', ordering=4,
+         help_text='String value with choices',
+         default=u'AUTO',
+         choices=(('ELEPHANT', _('Elephant')), ('ANT', _('Ant')), ('AUTO', _('Autodetect')),)),
+
+    # Listbox with multiple selection - MultipleStringValue with choices
+    MultipleStringValue( GR1_BOX, 'my_MultipleStringValue', 
+        description='Listbox - e.g. Required Fields', ordering=5, help_text='MultipleStringValue with choices',
+        default=['email', 'first_name'],
+        choices=(
+            ('email', _("Email")),
+            ('title', _("Title")),
+            ('first_name', _("First name")),
+            ('last_name', _("Last name")),
+        )),
+
+    # Password displayed like '****'.
+    PasswordValue( GR1_BOX, 'my_PasswordValue', description='Password value', ordering=6,
+        default='only to see *** now', render_value=True),
+    # If render_value=True (default) the widget will be pre-filled with an actual password value displayed like "****".
+    # If render_value=False, the password field is not pre-filled with any value
+    # and an actual value can be removed by writing space to the field (which is converted to empty string).
+
+)
+
+
+# Examples of other types
+
+GR_MORE = ConfigurationGroup('gr_more', _('More examples'), ordering=2)
+
+config_register_list(
+
+    IntegerValue( GR_MORE, 'my_IntegerValue', description='Integer value', ordering=1, default=-12),
+    # Input values are converted to int type.
+
+    PositiveIntegerValue( GR_MORE, 'my_PositiveIntegerValue', description='Positive integer value',
+        ordering=2, default=13),
+    # PositiveIntegerValue(...) is the same as IntegerValue(..., mini_value=0) 
+
+    DecimalValue( GR_MORE, 'my_DecimalValue', description='Decimal value', ordering=3,
+        default=Decimal('1.2300')),
+    # Input values are converted to type decimal.Decimal
+    # Possible default values are e.g. '4', '4.0', Decimal('4.0'), 4, etc.
+
+    DurationValue( GR_MORE, 'my_DurationValue', description='Duration value',
+        help_text='datetime type, input in second', ordering=4, default=25 * 3600.0),
+    # Input value in seconds is converted to type datetime.timedelta
+
+    FloatValue( GR_MORE, 'my_FloatValue', description='Float value', ordering=5,
+        default=3.14),
+    # Input values are converted to type float.
+
+    LongMultipleStringValue( GR_MORE, 'my_LongMultipleStringValue',
+        description='Long Multiple String Value with choices',  ordering=6,
+        default=['blablabla_b', 'blablabla_c'],
+        choices= tuple(('blablabla_' + x, 15 * x) for x in 'abcdefghijklmnopqrstuvwxyz'),
+        # This example requires storage in long string if all options are selected.
+        ),
+    # Combined Long and Multiple StringValue
+)
+
+
+# Example of enabling modules which have own settings groups in different files
+
+GR_MOD_FLYING = ConfigurationGroup('FLYING', 
+        _('Examples for modules - enabling subsettings of modules for... e.g. Flying :-)'), ordering=3)
+
+# Every module can have its own set of specific live settings, which are enabled/disabled together with a module.
+
+FLYING_MODULES = MultipleStringValue( GR_MOD_FLYING, 'MODULES',
+        description=_('Modules for Flying'),
+        choices=(('calendar', 'calendar'),),
+        default=['calendar',],
+        help_hext='Try to enable/disable these modules and save to see a more os less dependent settings',
+    )
+
+config_register_list(
+    FLYING_MODULES,
+
+    StringValue(GR_MOD_FLYING, 'first_day', description='Calendar - First day of week', default='Monday',
+        ordering=1,
+        choices=zip(* 2 * (('Sunday', 'Monday'),)),
+        requires=FLYING_MODULES,
+        requiresvalue='calendar',
+    )
+
+)
+
+# ==== This part is usually located in a separate file control.py in optional's module directory
+
+from decimal import Decimal
+from django.utils.translation import ugettext_lazy as _
+from livesettings import *
+
+FLYING_MODULES = config_get('FLYING', 'MODULES')
+FLYING_MODULES.add_choice(('django.contrib.webdesign.lorem_ipsum', 'Lorem Ipsum'))
+
+LOREM_GROUP = ConfigurationGroup('django.contrib.webdesign.lorem_ipsum',
+    _('Lorem Ipsum Settings'),
+    requires = FLYING_MODULES,
+    requiresvalue='django.contrib.webdesign.lorem_ipsum',
+    ordering = 101)
+
+config_register_list(
+    ModuleValue(LOREM_GROUP, 'MODULE', default='django.contrib.webdesign.lorem_ipsum', hidden=True),
+
+    MultipleStringValue(LOREM_GROUP, 'lorem_words', description='Lorem ipsum words',
+        choices= zip(* 2 * ('lorem ipsum dolor sit amet'.split(),))
+    )
+)
+
+# More examples for modules in "https://bitbucket.org/chris1610/satchmo/src/tip/satchmo/apps/payment/modules/"

File test-project/localsite/models.py

+import config

File test-project/localsite/templates/myapp/index.html

+<html><body>
+<pre>
+<p>Measurement system: {{ measurement_system }}</p>
+<p>Image count: {{ image_count }}</p>
+<p><a href="{% url satchmo_site_settings %}">Values can be modified</a> if the user has sufficient permissions (livesettings_setting:change).</p>
+</body></html>

File test-project/localsite/tests.py

+"""
+This file demonstrates writing tests using the unittest module. These will pass
+when you run "manage.py test".
+
+Replace this with more appropriate tests for your application.
+"""
+
+from django.test import TestCase
+
+
+class SimpleTest(TestCase):
+    def test_basic_addition(self):
+        """
+        Tests that 1 + 1 always equals 2.
+        """
+        self.assertEqual(1 + 1, 2)

File test-project/localsite/views.py

+from django.shortcuts import render_to_response
+from livesettings import config_value
+
+def index(request):
+    image_count = config_value('MyApp','NUM_IMAGES')
+    # Note, the measurement_system will return a list of selected values
+    # in this case, we use the first one
+    measurement_system = config_value('MyApp','MEASUREMENT_SYSTEM')
+    return render_to_response('myapp/index.html',
+                            {'image_count': image_count,
+                            'measurement_system': measurement_system[0]})

File test-project/manage.py

+#!/usr/bin/env python
+import os
+import sys
+
+if __name__ == "__main__":
+    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test_project.settings")
+
+    from django.core.management import execute_from_command_line
+
+    execute_from_command_line(sys.argv)

File test-project/test_project/__init__.py

Empty file added.

File test-project/test_project/settings.py

+# Django settings for test_project project.
+
+import os
+
+DIRNAME = os.path.dirname(__file__)
+
+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': 'test.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 = '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
+
+# 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 = ''
+
+# 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 = ''
+
+# 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 = 'co2e%^a9ek=j9=@#g(zc-z(yes(j9fw03flz+wh!b=4g@r3dr+'
+
+# 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',
+    # Uncomment the next line for simple clickjacking protection:
+    # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
+)
+
+ROOT_URLCONF = 'test_project.urls'
+
+# Python dotted path to the WSGI application used by Django's runserver.
+WSGI_APPLICATION = 'test_project.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 = (
+    'django.contrib.auth',
+    'django.contrib.contenttypes',
+    'django.contrib.sessions',
+    'django.contrib.sites',
+    'django.contrib.messages',
+    'django.contrib.staticfiles',
+    'django.contrib.admin',
+    'django.contrib.admindocs',
+
+    'django.contrib.comments',
+    'django.contrib.flatpages',
+    'django.contrib.sitemaps',
+    'livesettings',
+    'keyedcache',
+    'localsite',
+)
+
+CACHES = {
+    'default': {
+        'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
+        'TIMEOUT': 5,
+        # It is high recommended to configure a global cache for multiprocess
+        # servers, because other processes would not be notified about new
+        # values with LocMemCache. !!
+        # For debug server (manage.py runserver) is the default configuration safe.
+        #
+        #'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
+        #'LOCATION': '127.0.0.1:11211',
+        #'TIMEOUT': 300,
+        #'KEY_PREFIX': 'T',
+    }
+}
+
+# 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,
+        },
+    }
+}

File test-project/test_project/urls.py

+from django.conf.urls import patterns, include, url
+from django.contrib import admin
+admin.autodiscover()
+
+urlpatterns = patterns('',
+    (r'^settings/', include('livesettings.urls')),
+    (r'^admin/', include(admin.site.urls)),
+    (r'^accounts/login/', 'django.contrib.auth.views.login', {'template_name': 'admin/login.html'}),
+    (r'^$', 'localsite.views.index')
+
+)

File test-project/test_project/wsgi.py

+"""
+WSGI config for test_project project.
+
+This module contains the WSGI application used by Django's development server
+and any production WSGI deployments. It should expose a module-level variable
+named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
+this application via the ``WSGI_APPLICATION`` setting.
+
+Usually you will have the standard Django WSGI application here, but it also
+might make sense to replace the whole Django WSGI application with a custom one
+that later delegates to the Django one. For example, you could introduce WSGI
+middleware here, or combine a Django application with an application of another
+framework.
+
+"""
+import os
+
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test_project.settings")
+
+# This application object is used by any WSGI server configured to use this
+# file. This includes Django's development server, if the WSGI_APPLICATION
+# setting points here.
+from django.core.wsgi import get_wsgi_application
+application = get_wsgi_application()
+
+# Apply WSGI middleware here.
+# from helloworld.wsgi import HelloWorldApplication
+# application = HelloWorldApplication(application)