Source

fastdev-django / project / settings.py

Full commit

# Django settings for project project.

import os
PROJECT_ROOT = os.path.realpath(os.path.dirname(__file__))   # FASTDEV

ADMINS = (
	# ('Your Name', 'your_email@example.com'),
)

MANAGERS = ADMINS

# Database settings are in development.py & production.py

# 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

# 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 = os.path.join(PROJECT_ROOT, 'static')

# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = '/s/'

# URL prefix for admin static files -- CSS, JavaScript and images.
# Make sure to use a trailing slash.
# Examples: "http://foo.com/static/admin/", "/static/admin/".
ADMIN_MEDIA_PREFIX = '/s/admin/'

# Additional locations of static files
STATIC_DIR_NAMES = 'css img js'  # FASTDEV: edit this setting only
STATICFILES_DIRS = tuple((i, os.path.join(STATIC_ROOT, i)) for i in STATIC_DIR_NAMES.split())

# 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',
	'compressor.finders.CompressorFinder',                       # FASTDEV (compressor)
#	'django.contrib.staticfiles.finders.DefaultStorageFinder',
)

# Make this unique, and don't share it with anybody.
SECRET_KEY = 'g%ll2m3x$580@glgoma9bpa$k(z(%vxqy_0876g)-sm%z!6r&o'

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
	'djaml.filesystem',                                          # FASTDEV. djaml must be the topmost loader
	'django.template.loaders.filesystem.Loader',
	'django.template.loaders.app_directories.Loader',
#	 'django.template.loaders.eggs.Loader',
)

MIDDLEWARE_CLASSES = (
	# 'annoying.middlewares.StaticServe',
	'django.middleware.common.CommonMiddleware',
	'django.contrib.sessions.middleware.SessionMiddleware',
	'django.middleware.csrf.CsrfViewMiddleware',
	'django.contrib.auth.middleware.AuthenticationMiddleware',
	'django.contrib.messages.middleware.MessageMiddleware',
	'debug_toolbar.middleware.DebugToolbarMiddleware',
	'django.middleware.locale.LocaleMiddleware',
	'django.middleware.transaction.TransactionMiddleware',
#	'reversion.middleware.RevisionMiddleware',  # must be below TransactionMiddleware
)

ROOT_URLCONF = 'project.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.
	os.path.join(os.path.dirname(__file__), "templates"),
)

INSTALLED_APPS = (
	'django.contrib.auth',
	'django.contrib.contenttypes',
	'django.contrib.sessions',
	'django.contrib.sites',
	'django.contrib.messages',
	'django.contrib.staticfiles',

	'django_extensions',  # extensions adds shell_plus and other useful commands
	'debug_toolbar',  # enable/disable debug toolbar middleware to turn it on/off
#	'reversion',  # uncomment to use object versioning
#	'tastypie',  # uncomment to use RESTful APIs
	'compressor',  # for sass and js compressor
	'werkzeug',

	# Uncomment the next line to enable the admin:
	'django.contrib.admin',
	# Uncomment the next line to enable admin documentation:
	# 'django.contrib.admindocs',
	'project.apps.main',
)

# 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,
		},
	}
}


# BEGIN PUDB/URWID PATCH
# in order for Django (which is multithreaded) to use PuDB, urwid.raw_display must be patched to not send signals
# the signal_init(self) and signal_restore(self) methods of Screen must be patched with a noop
# see the following pages of the PuDB Wiki
# http://wiki.tiker.net/PuDB/DjangoIntegration
# http://wiki.tiker.net/PuDB/ZopeIntegration
# patch by Kevin Tran (kevin.tran@obnob.com, http://obnob.com)
"""from urwid.raw_display import Screen

def noop(self):
    pass
Screen.signal_init = noop
Screen.signal_restore = noop
"""
# END PUDB/URWID PATCH

COMPRESS = True
COMPRESS_PRECOMPILERS = (
	('text/sass', '%s {infile} {outfile}' % os.path.join(PROJECT_ROOT, '..', 'bin', 'sass')),
)

USE_COFFEE_SCRIPT = False
if USE_COFFEE_SCRIPT:
	COMPRESS_PRECOMPILERS += (
		('text/coffeescript', '%s -s -p < {infile} > {outfile}' % os.path.join(PROJECT_ROOT, '..', 'bin', 'coffee')),
	)

# turn this on to enable YUI compressor
COMPRESS_ENABLED = False
COMPRESS_JS_FILTERS = ['compressor.filters.yui.YUIJSFilter']
COMPRESS_CSS_FILTERS = ['compressor.filters.yui.YUICSSFilter']
COMPRESS_YUI_BINARY = os.path.join(PROJECT_ROOT, '..', 'bin', 'yuicompressor')