settings.py 8.32 KB
Newer Older
fred's avatar
fred committed
1 2 3 4 5
#!/usr/bin/env python
# coding: utf-8

import os

fred's avatar
fred committed
6 7
import django.conf.global_settings as DEFAULT_SETTINGS

fred's avatar
fred committed
8
DEBUG = True  # Turn off for production
9
DEBUG_TOOLBAR = False
fred's avatar
fred committed
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44

PROJECT_DIR = os.path.normpath(os.path.dirname(os.path.dirname(__file__)))
ADMINS = (
    # ('Your Name', 'your_email@domain.com'),
)
MANAGERS = ADMINS
DEFAULT_FROM_EMAIL = 'info@radiopanik.org'

LOGIN_REDIRECT_URL = '/'

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(PROJECT_DIR, 'panikweb.sqlite3'),
        'USER': '',
        'PASSWORD': '',
        'HOST': '',
        'PORT': '',
    },
}

ACCOUNT_ACTIVATION_DAYS = 7  # Activation window

#if django.VERSION[:2] < (1, 6):
TEST_RUNNER = 'discover_runner.DiscoverRunner'

# 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.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE = 'Europe/Brussels'

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
fred's avatar
fred committed
45
LANGUAGE_CODE = 'fr-be'
fred's avatar
fred committed
46 47 48

LANGUAGES = (
  ('fr', u'Français'),
fred's avatar
fred committed
49
  ('en', u'English'),
fred's avatar
fred committed
50 51 52 53 54 55 56 57
)

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

fred's avatar
fred committed
58 59
LOCALE_PATHS = (os.path.join(PROJECT_DIR, 'panikweb', 'locale'),)

fred's avatar
fred committed
60 61 62 63 64 65 66
# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/media/"
MEDIA_ROOT = os.path.join(PROJECT_DIR, 'media')

# 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/"
fred's avatar
fred committed
67
MEDIA_URL = '/media/'
fred's avatar
fred committed
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90

# 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_DIR, 'staticroot')

# 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',
fred's avatar
fred committed
91
    'gadjo.finders.XStaticFinder',
fred's avatar
fred committed
92 93 94
#    'django.contrib.staticfiles.finders.DefaultStorageFinder',
)

fred's avatar
fred committed
95

fred's avatar
fred committed
96 97 98 99
# Make this unique, and don't share it with anybody.
SECRET_KEY = '3qm&amp;@6264-=st16)7_xa*ds+31e0mqqs@+*!ud7gzt$tq!b^qn'

MIDDLEWARE_CLASSES = (
fred's avatar
fred committed
100
    'django.middleware.cache.UpdateCacheMiddleware',
fred's avatar
fred committed
101
    #'django.middleware.gzip.GZipMiddleware',
fred's avatar
fred committed
102
    'django.contrib.sessions.middleware.SessionMiddleware',
fred's avatar
fred committed
103
    'django.middleware.locale.LocaleMiddleware',
fred's avatar
fred committed
104 105 106 107 108
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    #'request.middleware.RequestMiddleware',
109
    'panikweb.middleware.StripPiwikCookieMiddleware',
fred's avatar
fred committed
110
    'django.middleware.cache.FetchFromCacheMiddleware',
fred's avatar
fred committed
111 112
)

fred's avatar
fred committed
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [
            os.path.join(PROJECT_DIR, 'panikweb_templates'),
        ],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.contrib.auth.context_processors.auth',
                'django.template.context_processors.debug',
                'django.template.context_processors.i18n',
                'django.template.context_processors.media',
                'django.template.context_processors.request',
                'django.template.context_processors.static',
                'django.template.context_processors.tz',
fred's avatar
fred committed
129
                'panikweb.context_processors.panikweb',
fred's avatar
fred committed
130
            ],
131 132 133
            'builtins': [
                'combo.public.templatetags.combo',
            ],
fred's avatar
fred committed
134 135 136
        },
    },
]
fred's avatar
fred committed
137 138


fred's avatar
fred committed
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
ROOT_URLCONF = 'panikweb.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.staticfiles',
    'django.contrib.admin',
    'django.contrib.admindocs',
fred's avatar
fred committed
156
    'haystack',
157
    'taggit',
fred's avatar
fred committed
158
    'gadjo',
fred's avatar
fred committed
159
    'panikweb_templates',
fred's avatar
fred committed
160
    'panikweb.paniktags',
161
    'sorl.thumbnail',
fred's avatar
fred committed
162 163 164
    'ckeditor',
    'emissions',
    'newsletter',
165
    'nonstop',
166 167
    'combo.data',
    'combo.public',
168
    'combo.profile',
169
    'combo.apps.assets',
fred's avatar
fred committed
170
    'combo.apps.dashboard',
171
    'combo.apps.search',
172
    'panikombo',
fred's avatar
fred committed
173
    'gallery',
fred's avatar
fred committed
174 175 176 177 178
)

CKEDITOR_UPLOAD_PATH = os.path.join(MEDIA_ROOT, 'uploads')
CKEDITOR_UPLOAD_PREFIX = '/media/uploads/'

fred's avatar
fred committed
179 180 181
HAYSTACK_CONNECTIONS = {
    'default': {
        'ENGINE': 'haystack.backends.solr_backend.SolrEngine',
182
        'URL': 'http://127.0.0.1:8985/solr/panik'
fred's avatar
fred committed
183 184
    },
}
fred's avatar
fred committed
185

fred's avatar
fred committed
186 187 188 189
FIBER_TEMPLATE_CHOICES = (
    ('tpl-default.html', 'Default template'),
)

190 191
ENABLE_PIWIK = False

fred's avatar
fred committed
192 193 194 195 196 197
CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
    },
}

198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220
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,
        },
    }
}
fred's avatar
fred committed
221

222 223
STATSD_CLIENT = 'django_statsd.clients.null'

fred's avatar
fred committed
224 225
RAVEN_CONFIG = None

226 227 228 229 230 231 232 233 234 235 236 237
DEBUG_TOOLBAR_PANELS = (
    'debug_toolbar.panels.version.VersionDebugPanel',
    'debug_toolbar.panels.timer.TimerDebugPanel',
    'debug_toolbar.panels.settings_vars.SettingsVarsDebugPanel',
    'debug_toolbar.panels.headers.HeaderDebugPanel',
    'debug_toolbar.panels.request_vars.RequestVarsDebugPanel',
    'debug_toolbar.panels.sql.SQLDebugPanel',
    'debug_toolbar.panels.template.TemplateDebugPanel',
    'debug_toolbar.panels.signals.SignalDebugPanel',
    'debug_toolbar.panels.logger.LoggingPanel',
)

238
from panikombo.misc import COMBO_PUBLIC_TEMPLATES
239

fred's avatar
fred committed
240
LANGUAGE_COOKIE_NAME = 'panikweb_language'
241

242 243
TEMPLATE_VARS = {}

fred's avatar
fred committed
244
COMBO_DASHBOARD_ENABLED = False
245 246
COMBO_MAP_TILE_URLTEMPLATE = ''
COMBO_MAP_ATTRIBUTION = ''
fred's avatar
fred committed
247
JSON_CELL_TYPES = {}
248
COMBO_CELL_ASSET_SLOTS = {}
fred's avatar
fred committed
249

fred's avatar
fred committed
250 251
RADIO_NAME = 'Radio Panik'
RADIO_LONG_NAME = 'Radio Panik - 105.4 FM'
fred's avatar
fred committed
252 253
WEBSITE_BASE_URL = 'http://www.radiopanik.org/'

254 255 256
COMBO_INITIAL_LOGIN_PAGE_PATH = '/'
COMBO_WELCOME_PAGE_PATH = None

257 258 259 260 261
local_settings_file = os.environ.get(
    'PANIKWEB_SETTINGS_FILE', os.path.join(os.path.dirname(__file__), 'local_settings.py')
)
if os.path.exists(local_settings_file):
    exec(open(local_settings_file).read())
fred's avatar
fred committed
262 263 264 265 266 267 268 269 270

if DEBUG and DEBUG_TOOLBAR:
    MIDDLEWARE_CLASSES += (
        'debug_toolbar.middleware.DebugToolbarMiddleware',
    )
    INSTALLED_APPS += (
        'debug_toolbar',
    )

271 272 273
    if 'template_timings_panel.panels.TemplateTimings.TemplateTimings' in DEBUG_TOOLBAR_PANELS:
        INSTALLED_APPS += ('template_timings_panel',)

274 275 276
if ENABLE_PIWIK is False:
    MIDDLEWARE_CLASSES = tuple([x for x in MIDDLEWARE_CLASSES \
                                if x != 'panikweb.middleware.StripPiwikCookieMiddleware'])
277

278 279 280 281 282
if STATSD_CLIENT != 'django_statsd.clients.null':
    MIDDLEWARE_CLASSES = (
            'django_statsd.middleware.GraphiteRequestTimingMiddleware',
            'django_statsd.middleware.GraphiteMiddleware',
    ) + MIDDLEWARE_CLASSES
fred's avatar
fred committed
283 284 285
    INSTALLED_APPS += (
        'django_statsd',
    )
fred's avatar
fred committed
286 287 288 289 290

if RAVEN_CONFIG:
    INSTALLED_APPS += (
        'raven.contrib.django.raven_compat',
    )