move User documents into mygpo_users database
[mygpo.git] / mygpo / settings.py
blob6a89b550c2e18c6a98d046c249237b7262310085
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_users'},
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_users'},
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_users'},
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',
90 'users': 'users',
93 # Local time zone for this installation. Choices can be found here:
94 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
95 # although not all choices may be available on all operating systems.
96 # If running in a Windows environment this must be set to the same as your
97 # system time zone.
98 TIME_ZONE = 'UTC'
100 # Language code for this installation. All choices can be found here:
101 # http://www.i18nguy.com/unicode/language-identifiers.html
102 LANGUAGE_CODE = 'en-us'
104 SITE_ID = 1
106 # If you set this to False, Django will make some optimizations so as not
107 # to load the internationalization machinery.
108 USE_I18N = True
110 STATIC_ROOT = 'staticfiles'
111 STATIC_URL = '/media/'
113 STATICFILES_DIRS = (
114 os.path.abspath(os.path.join(BASE_DIR, '..', 'htdocs', 'media')),
117 # List of callables that know how to import templates from various sources.
118 TEMPLATE_LOADERS = (
119 'django.template.loaders.app_directories.Loader',
122 MIDDLEWARE_CLASSES = (
123 'django.middleware.cache.UpdateCacheMiddleware',
124 'django.middleware.common.CommonMiddleware',
125 'django.middleware.csrf.CsrfViewMiddleware',
126 'django.middleware.cache.FetchFromCacheMiddleware',
127 'django.contrib.sessions.middleware.SessionMiddleware',
128 'django.contrib.auth.middleware.AuthenticationMiddleware',
129 'django.middleware.locale.LocaleMiddleware',
130 'django.contrib.messages.middleware.MessageMiddleware',
133 ROOT_URLCONF = 'mygpo.urls'
135 TEMPLATE_DIRS = ()
137 INSTALLED_APPS = (
138 'django.contrib.contenttypes', # unused, but tests fail otherwise (?)
139 'django.contrib.messages',
140 'django.contrib.humanize',
141 'django.contrib.staticfiles',
142 'couchdbkit.ext.django',
143 'django_couchdb_utils.auth',
144 'django_couchdb_utils.registration',
145 'djcelery',
146 'mygpo.core',
147 'mygpo.users',
148 'mygpo.api',
149 'mygpo.web',
150 'mygpo.publisher',
151 'mygpo.data',
152 'mygpo.userfeeds',
153 'mygpo.directory',
154 'mygpo.maintenance',
155 'mygpo.share',
156 'mygpo.admin',
157 'mygpo.pubsub',
158 'mygpo.db.couchdb',
161 TEST_EXCLUDE = (
162 'django',
163 'couchdbkit',
166 TEST_RUNNER='mygpo.test.MygpoTestSuiteRunner'
168 ACCOUNT_ACTIVATION_DAYS = 7
170 AUTHENTICATION_BACKENDS = (
171 'django_couchdb_utils.auth.backends.CouchDBAuthBackend',
172 'mygpo.web.auth.EmailAuthenticationBackend',
175 SESSION_ENGINE = "django_couchdb_utils.sessions.cached_couchdb"
178 from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS
180 TEMPLATE_CONTEXT_PROCESSORS += (
181 "mygpo.web.google.analytics",
182 "mygpo.web.google.adsense",
184 # make the debug variable available in templates
185 # https://docs.djangoproject.com/en/dev/ref/templates/api/#django-core-context-processors-debug
186 "django.core.context_processors.debug",
188 # required so that the request obj can be accessed from templates.
189 # this is used to direct users to previous page after login
190 'django.core.context_processors.request',
193 MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage'
195 USER_CLASS = 'mygpo.users.models.User'
197 LOGIN_URL = '/login/'
199 CSRF_FAILURE_VIEW='mygpo.web.views.security.csrf_failure'
202 # The following entries should be set in settings_prod.py
203 DEFAULT_FROM_EMAIL = ''
204 SECRET_KEY = ''
205 GOOGLE_ANALYTICS_PROPERTY_ID=''
206 DIRECTORY_EXCLUDED_TAGS = ()
207 FLICKR_API_KEY = ''
209 MAINTENANCE = os.path.exists(os.path.join(BASE_DIR, 'MAINTENANCE'))
212 LOGGING = {
213 'version': 1,
214 'disable_existing_loggers': True,
215 'formatters': {
216 'verbose': {
217 'format': '%(asctime)s %(name)s %(levelname)s %(message)s',
220 'filters': {
221 'require_debug_false': {
222 '()': 'django.utils.log.RequireDebugFalse'
225 'handlers': {
226 'console':{
227 'level': 'DEBUG',
228 'class': 'logging.StreamHandler',
229 'formatter': 'verbose'
231 'mail_admins': {
232 'level': 'ERROR',
233 'filters': ['require_debug_false'],
234 'class': 'django.utils.log.AdminEmailHandler'
237 'loggers': {
238 'django': {
239 'handlers': ['console'],
240 'propagate': True,
241 'level': 'WARN',
243 'mygpo': {
244 'handlers': ['console'],
245 'level': 'INFO',
250 # minimum number of subscribers a podcast must have to be assigned a slug
251 PODCAST_SLUG_SUBSCRIBER_LIMIT = 10
253 # minimum number of subscribers that a podcast needs to "push" one of its
254 # categories to the top
255 MIN_SUBSCRIBERS_CATEGORY=10
257 # maximum number of episode actions that the API processes immediatelly before
258 # returning the response. Larger requests will be handled in background.
259 # Handler can be set to None to disable
260 API_ACTIONS_MAX_NONBG=100
261 API_ACTIONS_BG_HANDLER='mygpo.api.tasks.episode_actions_celery_handler'
264 ADSENSE_CLIENT = ''
265 ADSENSE_SLOT_BOTTOM = ''
267 # enabled access to staff-only areas with ?staff=<STAFF_TOKEN>
268 STAFF_TOKEN = None
270 # Flattr settings -- available after you register your app
271 FLATTR_KEY = ''
272 FLATTR_SECRET = ''
274 # Flattr thing of the webservice. Will be flattr'd when a user sets the "Auto-Flattr gpodder.net" option
275 FLATTR_MYGPO_THING='https://flattr.com/submit/auto?user_id=stefankoegl&url=http://gpodder.net'
277 # The User-Agent string used for outgoing HTTP requests
278 USER_AGENT = 'gpodder.net (+https://github.com/gpodder/mygpo)'
280 # Base URL of the website that is used if the actually used parameters is not
281 # available. Request handlers, for example, can access the requested domain.
282 # Code that runs in background can not do this, and therefore requires a
283 # default value. This should be set to something like 'http://example.com'
284 DEFAULT_BASE_URL = ''
287 ### Celery
289 BROKER_URL='redis://localhost'
290 CELERY_RESULT_BACKEND='redis://localhost'
292 import djcelery
293 djcelery.setup_loader()
295 # a dictionary containing celery settings from
296 # http://docs.celeryproject.org/en/latest/configuration.html
297 CELERY_CONF = dict(
298 CELERY_SEND_TASK_ERROR_EMAILS = True,
299 ADMINS=ADMINS,
300 SERVER_EMAIL = "no-reply@example.com",
304 ### Google API
306 GOOGLE_CLIENT_ID=''
307 GOOGLE_CLIENT_SECRET=''
311 try:
312 from settings_prod import *
313 except ImportError, e:
314 import sys
315 print >> sys.stderr, 'create settings_prod.py with your customized settings'