various fixes
[mygpo.git] / mygpo / settings.py
blob18f97fa60baa7b0afc51542940e3d5458dfe154f
1 # Django settings for mygpo project.
3 # This file is part of my.gpodder.org.
5 # my.gpodder.org is free software: you can redistribute it and/or modify it
6 # under the terms of the GNU Affero General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or (at your
8 # option) any later version.
10 # my.gpodder.org is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
13 # License for more details.
15 # You should have received a copy of the GNU Affero General Public License
16 # along with my.gpodder.org. If not, see <http://www.gnu.org/licenses/>.
19 import os.path
21 BASE_DIR = os.path.dirname(os.path.abspath(__file__))
23 # http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges#ChangedthewayURLpathsaredetermined
24 FORCE_SCRIPT_NAME=""
26 DEBUG = True
27 TEMPLATE_DEBUG = DEBUG
29 ADMINS = ()
31 MANAGERS = ADMINS
33 # dummy entry.
34 # not needed for production, but tests fail otherwise in Django 1.4
35 DATABASES = {
36 'default': {
37 'ENGINE': 'django.db.backends.sqlite3',
38 'NAME': 'tmp',
42 COUCHDB_DATABASES = {
43 'mygpo.directory':
44 {'URL': 'http://127.0.0.1:5984/mygpo'},
46 'mygpo.core':
47 {'URL': 'http://127.0.0.1:5984/mygpo'},
49 'mygpo.api':
50 {'URL': 'http://127.0.0.1:5984/mygpo'},
52 'mygpo.users':
53 {'URL': 'http://127.0.0.1:5984/mygpo'},
55 'mygpo.share':
56 {'URL': 'http://127.0.0.1:5984/mygpo'},
58 'mygpo.maintenance':
59 {'URL': 'http://127.0.0.1:5984/mygpo'},
61 'mygpo.pubsub':
62 {'URL': 'http://127.0.0.1:5984/mygpo_pubsub'},
64 'django_couchdb_utils_auth':
65 {'URL': 'http://127.0.0.1:5984/mygpo'},
67 'django_couchdb_utils_sessions':
68 {'URL': 'http://127.0.0.1:5984/mygpo_sessions'},
70 'django_couchdb_utils_registration':
71 {'URL': 'http://127.0.0.1:5984/mygpo'},
73 'mygpo.categories':
74 {'URL': 'http://127.0.0.1:5984/mygpo_categories'},
76 'mygpo.userdata':
77 {'URL': 'http://127.0.0.1:5984/mygpo_userdata'},
80 # Maps design documents to databases. The keys correspond to the directories in
81 # mygpo/couch/, the values are the app labels which are mapped to the actual
82 # databases in COUCHDB_DATABASES. This indirect mapping is used because
83 # COUCHDB_DATABASES is likely to be overwritten in settings_prod.py while
84 # COUCHDB_DDOC_MAPPING is most probably not overwritten.
85 COUCHDB_DDOC_MAPPING = {
86 'general': 'core',
87 'categories': 'categories',
88 'pubsub': 'pubsub',
89 'userdata': 'userdata',
92 # Local time zone for this installation. Choices can be found here:
93 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
94 # although not all choices may be available on all operating systems.
95 # If running in a Windows environment this must be set to the same as your
96 # system time zone.
97 TIME_ZONE = 'UTC'
99 # Language code for this installation. All choices can be found here:
100 # http://www.i18nguy.com/unicode/language-identifiers.html
101 LANGUAGE_CODE = 'en-us'
103 SITE_ID = 1
105 # If you set this to False, Django will make some optimizations so as not
106 # to load the internationalization machinery.
107 USE_I18N = True
109 STATIC_ROOT = 'staticfiles'
110 STATIC_URL = '/media/'
112 STATICFILES_DIRS = (
113 os.path.abspath(os.path.join(BASE_DIR, '..', 'htdocs', 'media')),
116 # List of callables that know how to import templates from various sources.
117 TEMPLATE_LOADERS = (
118 'django.template.loaders.app_directories.Loader',
121 MIDDLEWARE_CLASSES = (
122 'django.middleware.cache.UpdateCacheMiddleware',
123 'django.middleware.common.CommonMiddleware',
124 'django.middleware.csrf.CsrfViewMiddleware',
125 'django.middleware.cache.FetchFromCacheMiddleware',
126 'django.contrib.sessions.middleware.SessionMiddleware',
127 'django.contrib.auth.middleware.AuthenticationMiddleware',
128 'django.middleware.locale.LocaleMiddleware',
129 'django.contrib.messages.middleware.MessageMiddleware',
132 ROOT_URLCONF = 'mygpo.urls'
134 TEMPLATE_DIRS = ()
136 INSTALLED_APPS = (
137 'django.contrib.contenttypes', # unused, but tests fail otherwise (?)
138 'django.contrib.messages',
139 'django.contrib.humanize',
140 'django.contrib.staticfiles',
141 'couchdbkit.ext.django',
142 'django_couchdb_utils.auth',
143 'django_couchdb_utils.registration',
144 'mygpo.core',
145 'mygpo.users',
146 'mygpo.api',
147 'mygpo.web',
148 'mygpo.publisher',
149 'mygpo.data',
150 'mygpo.userfeeds',
151 'mygpo.directory',
152 'mygpo.maintenance',
153 'mygpo.share',
154 'mygpo.admin',
155 'mygpo.pubsub',
156 'mygpo.db.couchdb',
159 TEST_EXCLUDE = (
160 'django',
161 'couchdbkit',
164 TEST_RUNNER='mygpo.test.MygpoTestSuiteRunner'
166 ACCOUNT_ACTIVATION_DAYS = 7
168 AUTHENTICATION_BACKENDS = (
169 'django_couchdb_utils.auth.backends.CouchDBAuthBackend',
170 'mygpo.web.auth.EmailAuthenticationBackend',
173 SESSION_ENGINE = "django_couchdb_utils.sessions.cached_couchdb"
175 TEMPLATE_CONTEXT_PROCESSORS = (
176 "django.contrib.auth.context_processors.auth",
177 "django.core.context_processors.debug",
178 "django.core.context_processors.i18n",
179 "django.core.context_processors.media",
180 "django.contrib.messages.context_processors.messages",
181 "mygpo.web.google.analytics",
182 "mygpo.web.google.adsense",
185 MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage'
187 USER_CLASS = 'mygpo.users.models.User'
189 LOGIN_URL = '/login/'
191 CSRF_FAILURE_VIEW='mygpo.web.views.security.csrf_failure'
194 # The following entries should be set in settings_prod.py
195 DEFAULT_FROM_EMAIL = ''
196 SECRET_KEY = ''
197 GOOGLE_ANALYTICS_PROPERTY_ID=''
198 DIRECTORY_EXCLUDED_TAGS = ()
199 FLICKR_API_KEY = ''
201 MAINTENANCE = os.path.exists(os.path.join(BASE_DIR, 'MAINTENANCE'))
203 EMAIL_BACKEND = 'django_couchdb_utils.email.backends.CouchDBEmailBackend'
206 LOGGING = {
207 'version': 1,
208 'disable_existing_loggers': True,
209 'formatters': {
210 'verbose': {
211 'format': '%(asctime)s %(name)s %(levelname)s %(message)s',
214 'filters': {
215 'require_debug_false': {
216 '()': 'django.utils.log.RequireDebugFalse'
219 'handlers': {
220 'console':{
221 'level': 'DEBUG',
222 'class': 'logging.StreamHandler',
223 'formatter': 'verbose'
225 'mail_admins': {
226 'level': 'ERROR',
227 'filters': ['require_debug_false'],
228 'class': 'django.utils.log.AdminEmailHandler'
231 'loggers': {
232 'django': {
233 'handlers': ['console'],
234 'propagate': True,
235 'level': 'WARN',
237 'mygpo': {
238 'handlers': ['console'],
239 'level': 'INFO',
244 # minimum number of subscribers a podcast must have to be assigned a slug
245 PODCAST_SLUG_SUBSCRIBER_LIMIT = 10
247 # minimum number of subscribers that a podcast needs to "push" one of its
248 # categories to the top
249 MIN_SUBSCRIBERS_CATEGORY=10
251 # maximum number of episode actions that the API processes immediatelly before
252 # returning the response. Larger requests will be handled in background.
253 # Handler can be set to None to disable
254 API_ACTIONS_MAX_NONBG=100
255 API_ACTIONS_BG_HANDLER='mygpo.api.tasks.episode_actions_celery_handler'
258 ADSENSE_CLIENT = ''
259 ADSENSE_SLOT_BOTTOM = ''
261 # enabled access to staff-only areas with ?staff=<STAFF_TOKEN>
262 STAFF_TOKEN = None
264 # Flattr settings -- available after you register your app
265 FLATTR_KEY = ''
266 FLATTR_SECRET = ''
268 # Flattr thing of the webservice. Will be flattr'd when a user sets the "Auto-Flattr gpodder.net" option
269 FLATTR_MYGPO_THING='https://flattr.com/submit/auto?user_id=stefankoegl&url=http://gpodder.net'
271 # The User-Agent string used for outgoing HTTP requests
272 USER_AGENT = 'gpodder.net (+https://github.com/gpodder/mygpo)'
274 # Base URL of the website that is used if the actually used parameters is not
275 # available. Request handlers, for example, can access the requested domain.
276 # Code that runs in background can not do this, and therefore requires a
277 # default value. This should be set to something like 'http://example.com'
278 DEFAULT_BASE_URL = ''
281 ### Celery
283 BROKER_URL='redis://localhost'
284 BACKEND_URL='redis://localhost'
287 # a dictionary containing celery settings from
288 # http://docs.celeryproject.org/en/latest/configuration.html
289 CELERY_CONF = dict(
290 CELERY_SEND_TASK_ERROR_EMAILS = True,
291 ADMINS=ADMINS,
292 SERVER_EMAIL = "no-reply@example.com",
296 ### Google API
298 GOOGLE_CLIENT_ID=''
299 GOOGLE_CLIENT_SECRET=''
303 try:
304 from settings_prod import *
305 except ImportError, e:
306 import sys
307 print >> sys.stderr, 'create settings_prod.py with your customized settings'