]> git.0d.be Git - panikweb.git/blobdiff - panikweb/settings.py
misc: add support for offsite podcasts
[panikweb.git] / panikweb / settings.py
index 5100a25c2cbff7296b97da21c0402404dc0939c1..c007872e1f881f411ceb302018dd4a39fce363e2 100644 (file)
@@ -1,15 +1,15 @@
 #!/usr/bin/env python
-# coding: utf-8
 
 import os
 
 import django.conf.global_settings as DEFAULT_SETTINGS
 
 DEBUG = True  # Turn off for production
-TEMPLATE_DEBUG = DEBUG
-DEBUG_TOOLBAR = True
+DEBUG_TOOLBAR = False
 
 PROJECT_DIR = os.path.normpath(os.path.dirname(os.path.dirname(__file__)))
+PROJECT_PATH = os.path.dirname(os.path.dirname(__file__))
+
 ADMINS = (
     # ('Your Name', 'your_email@domain.com'),
 )
@@ -31,7 +31,7 @@ DATABASES = {
 
 ACCOUNT_ACTIVATION_DAYS = 7  # Activation window
 
-#if django.VERSION[:2] < (1, 6):
+# if django.VERSION[:2] < (1, 6):
 TEST_RUNNER = 'discover_runner.DiscoverRunner'
 
 # Local time zone for this installation. Choices can be found here:
@@ -43,10 +43,11 @@ TIME_ZONE = 'Europe/Brussels'
 
 # Language code for this installation. All choices can be found here:
 # http://www.i18nguy.com/unicode/language-identifiers.html
-LANGUAGE_CODE = 'en-us'
+LANGUAGE_CODE = 'fr-be'
 
 LANGUAGES = (
-  ('fr', u'Français'),
+    ('fr', 'Français'),
+    ('en', 'English'),
 )
 
 SITE_ID = 1
@@ -55,6 +56,8 @@ SITE_ID = 1
 # to load the internationalization machinery.
 USE_I18N = True
 
+LOCALE_PATHS = (os.path.join(PROJECT_DIR, 'panikweb', 'locale'),)
+
 # 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')
@@ -79,6 +82,7 @@ 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.
+    os.path.join(PROJECT_PATH, 'panikweb', 'static'),
 )
 
 # List of finder classes that know how to find static files in
@@ -86,35 +90,52 @@ STATICFILES_DIRS = (
 STATICFILES_FINDERS = (
     'django.contrib.staticfiles.finders.FileSystemFinder',
     'django.contrib.staticfiles.finders.AppDirectoriesFinder',
-    'compressor.finders.CompressorFinder',
-#    'django.contrib.staticfiles.finders.DefaultStorageFinder',
+    'gadjo.finders.XStaticFinder',
+    #    'django.contrib.staticfiles.finders.DefaultStorageFinder',
 )
 
+
 # Make this unique, and don't share it with anybody.
 SECRET_KEY = '3qm&amp;@6264-=st16)7_xa*ds+31e0mqqs@+*!ud7gzt$tq!b^qn'
 
-# 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.load_template_source',
-)
-
-MIDDLEWARE_CLASSES = (
+MIDDLEWARE = (
+    'django.middleware.cache.UpdateCacheMiddleware',
+    #'django.middleware.gzip.GZipMiddleware',
     'django.contrib.sessions.middleware.SessionMiddleware',
     'django.middleware.locale.LocaleMiddleware',
     'django.middleware.common.CommonMiddleware',
     'django.middleware.csrf.CsrfViewMiddleware',
     'django.contrib.auth.middleware.AuthenticationMiddleware',
     'django.contrib.messages.middleware.MessageMiddleware',
-    'fiber.middleware.ObfuscateEmailAddressMiddleware',
-    'fiber.middleware.AdminPageMiddleware',
     #'request.middleware.RequestMiddleware',
+    'panikweb.middleware.StripPiwikCookieMiddleware',
+    'django.middleware.cache.FetchFromCacheMiddleware',
 )
 
-TEMPLATE_CONTEXT_PROCESSORS = DEFAULT_SETTINGS.TEMPLATE_CONTEXT_PROCESSORS + (
-    'django.core.context_processors.request',
-)
+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',
+                'panikweb.context_processors.panikweb',
+            ],
+            'builtins': [
+                'combo.public.templatetags.combo',
+            ],
+        },
+    },
+]
 
 
 ROOT_URLCONF = 'panikweb.urls'
@@ -132,20 +153,30 @@ INSTALLED_APPS = (
     'django.contrib.sites',
     'django.contrib.messages',
     'django.contrib.staticfiles',
-    'django.contrib.admin',
-    'django.contrib.admindocs',
-    'south',
     'haystack',
     'taggit',
-    'panikweb_templates',
+    'gadjo',
     'panikweb.paniktags',
-    'mptt',
-    'compressor',
-    'fiber',
-    'jquery',
+    'panikweb.webstats',
+    'sorl.thumbnail',
     'ckeditor',
     'emissions',
     'newsletter',
+    'nonstop',
+    'combo.data',
+    'combo.public',
+    'combo.profile',
+    'combo.apps.assets',
+    'combo.apps.dashboard',
+    'combo.apps.gallery',
+    'combo.apps.maps',
+    'combo.apps.notifications',
+    'combo.apps.pwa',
+    'combo.apps.search',
+    'panikombo',
+    'xstatic.pkg.leaflet',
+    'xstatic.pkg.leaflet_markercluster',
+    'xstatic.pkg.leaflet_gesturehandling',
 )
 
 CKEDITOR_UPLOAD_PATH = os.path.join(MEDIA_ROOT, 'uploads')
@@ -154,28 +185,131 @@ CKEDITOR_UPLOAD_PREFIX = '/media/uploads/'
 HAYSTACK_CONNECTIONS = {
     'default': {
         'ENGINE': 'haystack.backends.solr_backend.SolrEngine',
-        'URL': 'http://127.0.0.1:8985/solr/panik'
+        'URL': 'http://127.0.0.1:8985/solr/panik',
     },
 }
 
-FIBER_TEMPLATE_CHOICES = (
-    ('tpl-default.html', 'Default template'),
-)
+FIBER_TEMPLATE_CHOICES = (('tpl-default.html', 'Default template'),)
+
+ENABLE_PIWIK = False
+
+CACHES = {
+    'default': {
+        'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
+    },
+}
+
+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,
+        },
+    },
+}
+
+STATSD_CLIENT = 'django_statsd.clients.null'
+
+RAVEN_CONFIG = None
+
+ACCESS_LOG_FILENAME = '/var/log/nginx/panikweb-access.log'
+
+from panikombo.misc import COMBO_PUBLIC_TEMPLATES
 
-try:
-    from local_settings import *
-except ImportError, e:
-    pass
+LANGUAGE_COOKIE_NAME = 'panikweb_language'
+
+TEMPLATE_VARS = {
+    'pwa_display': 'standalone',
+    'theme_color': "#000000",
+}
+
+COMBO_DASHBOARD_ENABLED = False
+COMBO_MAP_TILE_URLTEMPLATE = ''
+COMBO_MAP_ATTRIBUTION = ''
+JSON_CELL_TYPES = {}
+COMBO_CELL_ASSET_SLOTS = {}
+
+RADIO_NAME = 'Radio Panik'
+RADIO_LONG_NAME = 'Radio Panik - 105.4 FM'
+RADIO_META_DESCRIPTION = None
+WEBSITE_BASE_URL = 'https://www.radiopanik.org/'
+PODCASTS_DEFAULT_IMAGE_PATH = '/static/img/logo-panik-500.png'
+RADIO_STREAM_URLS = [
+    {
+        'id': 'ogg',
+        'm3u_url': 'https://streaming.domainepublic.net/radiopanik.ogg.m3u',
+        'url': 'https://streaming.domainepublic.net/radiopanik.ogg',
+        'type': 'audio/ogg',
+    },
+    {
+        'id': 'mp3',
+        'm3u_url': 'https://streaming.domainepublic.net/radiopanik.mp3.m3u',
+        'url': 'https://streaming.domainepublic.net/radiopanik.mp3',
+        'type': 'audio/mpeg',
+    },
+]
+
+HOME_EMISSIONS_COUNT = 3
+HOME_FOCUS_COUNT = 3
+HOME_NEWSITEMS_COUNT = 3
+HOME_PODCASTS_COUNT = 3
+USE_AGENDA_ONLY_FIELD = False
+
+# allow to serve from an alternative path if file is not found locally,
+# to be used with nginx, sth like
+#  location /remote_media {
+#    internal;
+#    proxy_pass https://panikdb.radiopanik.org/media/;
+#    proxy_limit_rate 500k;
+#  }
+#  location /local_media {
+#    internal;
+#    alias /srv/www.radiopanik.org/media;
+#  }
+# with OFFSITE_MEDIA_SOUNDS = ('/local_media/', '/remote_media/')
+OFFSITE_MEDIA_SOUNDS = None
+
+PROGRAM_PREFIX = 'programme/'
+EMISSIONS_PREFIX = 'emissions/'
+NEWSITEMS_PREFIX = 'actus/'
+
+THUMBNAIL_BACKEND = 'panikweb.utils.ThumbnailBackend'
+
+COMBO_INITIAL_LOGIN_PAGE_PATH = '/'
+COMBO_WELCOME_PAGE_PATH = None
+COMBO_CELL_TEMPLATES = {}
+CELL_CONDITIONS_ENABLED = False
+
+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())
 
 if DEBUG and DEBUG_TOOLBAR:
-    MIDDLEWARE_CLASSES += (
-        'debug_toolbar.middleware.DebugToolbarMiddleware',
-    )
-    INSTALLED_APPS += (
-        'debug_toolbar',
-    )
-    DEBUG_TOOLBAR_CONFIG = {
-        'INTERCEPT_REDIRECTS': False,
-    }
+    MIDDLEWARE += ('debug_toolbar.middleware.DebugToolbarMiddleware',)
+    INSTALLED_APPS += ('debug_toolbar',)
+
+if ENABLE_PIWIK is False:
+    MIDDLEWARE = tuple(x for x in MIDDLEWARE if x != 'panikweb.middleware.StripPiwikCookieMiddleware')
 
+if STATSD_CLIENT != 'django_statsd.clients.null':
+    MIDDLEWARE = (
+        'django_statsd.middleware.GraphiteRequestTimingMiddleware',
+        'django_statsd.middleware.GraphiteMiddleware',
+    ) + MIDDLEWARE
+    INSTALLED_APPS += ('django_statsd',)
 
+if RAVEN_CONFIG:
+    INSTALLED_APPS += ('raven.contrib.django.raven_compat',)