1 """Common settings and globals."""
4 from datetime import timedelta
5 from os.path import abspath, basename, dirname, join, normpath
8 from djcelery import setup_loader
11 ########## PATH CONFIGURATION
12 # Absolute filesystem path to the Django project directory:
13 DJANGO_ROOT = dirname(dirname(abspath(__file__)))
15 # Absolute filesystem path to the top-level project folder:
16 SITE_ROOT = dirname(DJANGO_ROOT)
19 SITE_NAME = basename(DJANGO_ROOT)
21 # Add our project to our pythonpath, this way we don't need to type our project
22 # name in our dotted import paths:
23 path.append(DJANGO_ROOT)
24 ########## END PATH CONFIGURATION
27 ########## DEBUG CONFIGURATION
28 # See: https://docs.djangoproject.com/en/dev/ref/settings/#debug
31 # See: https://docs.djangoproject.com/en/dev/ref/settings/#template-debug
32 TEMPLATE_DEBUG = DEBUG
33 ########## END DEBUG CONFIGURATION
36 ########## MANAGER CONFIGURATION
37 # See: https://docs.djangoproject.com/en/dev/ref/settings/#admins
39 ('Your Name', 'your_email@example.com'),
42 # See: https://docs.djangoproject.com/en/dev/ref/settings/#managers
44 ########## END MANAGER CONFIGURATION
47 ########## DATABASE CONFIGURATION
48 # See: https://docs.djangoproject.com/en/dev/ref/settings/#databases
51 'ENGINE': 'django.db.backends.',
59 ########## END DATABASE CONFIGURATION
62 ########## GENERAL CONFIGURATION
63 # See: https://docs.djangoproject.com/en/dev/ref/settings/#time-zone
64 TIME_ZONE = 'America/Los_Angeles'
66 # See: https://docs.djangoproject.com/en/dev/ref/settings/#language-code
67 LANGUAGE_CODE = 'en-us'
69 # See: https://docs.djangoproject.com/en/dev/ref/settings/#site-id
72 # See: https://docs.djangoproject.com/en/dev/ref/settings/#use-i18n
75 # See: https://docs.djangoproject.com/en/dev/ref/settings/#use-l10n
77 ########## END GENERAL CONFIGURATION
80 ########## MEDIA CONFIGURATION
81 # See: https://docs.djangoproject.com/en/dev/ref/settings/#media-root
82 MEDIA_ROOT = normpath(join(DJANGO_ROOT, 'media'))
84 # See: https://docs.djangoproject.com/en/dev/ref/settings/#media-url
86 ########## END MEDIA CONFIGURATION
89 ########## STATIC FILE CONFIGURATION
90 # See: https://docs.djangoproject.com/en/dev/ref/settings/#static-root
91 STATIC_ROOT = normpath(join(DJANGO_ROOT, 'static'))
93 # See: https://docs.djangoproject.com/en/dev/ref/settings/#static-url
94 STATIC_URL = '/static/'
96 # See: https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#std:setting-STATICFILES_DIRS
98 normpath(join(DJANGO_ROOT, 'assets')),
101 # See: https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#staticfiles-finders
102 STATICFILES_FINDERS = (
103 'django.contrib.staticfiles.finders.FileSystemFinder',
104 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
105 'compressor.finders.CompressorFinder',
107 ########## END STATIC FILE CONFIGURATION
110 ########## SECRET CONFIGURATION
111 # See: https://docs.djangoproject.com/en/dev/ref/settings/#secret-key
112 SECRET_KEY = r"(s1k!&^7l28k&nrm2ek(qqo&19%y(zn#=^zq_*ur2@irjun0x4"
113 ########## END SECRET CONFIGURATION
116 ########## FIXTURE CONFIGURATION
117 # See: https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-FIXTURE_DIRS
119 normpath(join(DJANGO_ROOT, 'fixtures')),
121 ########## END FIXTURE CONFIGURATION
124 ########## TEMPLATE CONFIGURATION
125 # See: https://docs.djangoproject.com/en/dev/ref/settings/#template-context-processors
126 TEMPLATE_CONTEXT_PROCESSORS = (
127 'django.contrib.auth.context_processors.auth',
128 'django.core.context_processors.debug',
129 'django.core.context_processors.i18n',
130 'django.core.context_processors.media',
131 'django.core.context_processors.static',
132 'django.core.context_processors.tz',
133 'django.contrib.messages.context_processors.messages',
134 'django.core.context_processors.request',
137 # See: https://docs.djangoproject.com/en/dev/ref/settings/#template-loaders
139 'django.template.loaders.filesystem.Loader',
140 'django.template.loaders.app_directories.Loader',
143 # See: https://docs.djangoproject.com/en/dev/ref/settings/#template-dirs
145 normpath(join(DJANGO_ROOT, 'templates')),
147 ########## END TEMPLATE CONFIGURATION
150 ########## MIDDLEWARE CONFIGURATION
151 # See: https://docs.djangoproject.com/en/dev/ref/settings/#middleware-classes
152 MIDDLEWARE_CLASSES = (
153 # Use GZip compression to reduce bandwidth.
154 'django.middleware.gzip.GZipMiddleware',
156 # Default Django middleware.
157 'django.middleware.common.CommonMiddleware',
158 'django.contrib.sessions.middleware.SessionMiddleware',
159 'django.middleware.csrf.CsrfViewMiddleware',
160 'django.contrib.auth.middleware.AuthenticationMiddleware',
161 'django.contrib.messages.middleware.MessageMiddleware',
163 ########## END MIDDLEWARE CONFIGURATION
166 ########## URL CONFIGURATION
167 # See: https://docs.djangoproject.com/en/dev/ref/settings/#root-urlconf
168 ROOT_URLCONF = '%s.urls' % SITE_NAME
169 ########## END URL CONFIGURATION
172 ########## APP CONFIGURATION
174 # Default Django apps:
175 'django.contrib.auth',
176 'django.contrib.contenttypes',
177 'django.contrib.sessions',
178 'django.contrib.sites',
179 'django.contrib.messages',
180 'django.contrib.staticfiles',
182 # Useful template tags:
183 'django.contrib.humanize',
185 # Admin panel and documentation:
186 'django.contrib.admin',
187 'django.contrib.admindocs',
191 # Database migration helpers:
194 # Static file management:
197 # Asynchronous task queue:
200 # Tagging https://github.com/yedpodtrzitko/django-taggit
206 'karmaworld.apps.notes',
209 # See: https://docs.djangoproject.com/en/dev/ref/settings/#installed-apps
210 INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + LOCAL_APPS
211 ########## END APP CONFIGURATION
214 ########## LOGGING CONFIGURATION
215 # See: https://docs.djangoproject.com/en/dev/ref/settings/#logging
218 'disable_existing_loggers': False,
222 'class': 'django.utils.log.AdminEmailHandler'
227 'handlers': ['mail_admins'],
233 ########## END LOGGING CONFIGURATION
236 ########## CELERY CONFIGURATION
237 # See: http://celery.readthedocs.org/en/latest/configuration.html#celery-task-result-expires
238 CELERY_TASK_RESULT_EXPIRES = timedelta(minutes=30)
240 # See: http://celery.github.com/celery/django/
242 ########## END CELERY CONFIGURATION
245 ########## WSGI CONFIGURATION
246 # See: https://docs.djangoproject.com/en/dev/ref/settings/#wsgi-application
247 WSGI_APPLICATION = 'wsgi.application'
248 ########## END WSGI CONFIGURATION
251 ########## COMPRESSION CONFIGURATION
252 # See: http://django_compressor.readthedocs.org/en/latest/settings/#django.conf.settings.COMPRESS_ENABLED
253 COMPRESS_ENABLED = True
255 # See: http://django_compressor.readthedocs.org/en/latest/settings/#django.conf.settings.COMPRESS_CSS_FILTERS
256 COMPRESS_CSS_FILTERS = [
257 'compressor.filters.template.TemplateFilter',
260 # See: http://django_compressor.readthedocs.org/en/latest/settings/#django.conf.settings.COMPRESS_JS_FILTERS
261 COMPRESS_JS_FILTERS = [
262 'compressor.filters.template.TemplateFilter',
264 ########## END COMPRESSION CONFIGURATION
266 ########## TAGGIT CONFIGURATION
267 # From https://github.com/yedpodtrzitko/django-taggit
270 TAGGIT_FORCE_LOWERCASE = True
272 # Ignore common stopwords
273 TAGGIT_STOPWORDS = [u'a', u'an', u'and', u'be', u'from', u'of']
275 ########## END TAGGIT CONFIGURATION