[PubSub] remove now unused code to complete migration
[mygpo.git] / mygpo / settings.py
blob8c5c14fe6e3b99903560b75ac82101e637012ade
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 sys
20 import os.path
21 import dj_database_url
23 BASE_DIR = os.path.dirname(os.path.abspath(__file__))
25 # http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges#ChangedthewayURLpathsaredetermined
26 FORCE_SCRIPT_NAME=""
28 DEBUG = True
29 TEMPLATE_DEBUG = DEBUG
31 ADMINS = ()
33 MANAGERS = ADMINS
35 DATABASES = {
36 'default': dj_database_url.config(
37 default='postgres://mygpo:mygpo@localhost/mygpo'),
40 COUCHDB_DATABASES = {
41 'mygpo.directory':
42 {'URL': 'http://127.0.0.1:5984/mygpo_categories'},
44 'mygpo.users':
45 {'URL': 'http://127.0.0.1:5984/mygpo_users'},
47 'mygpo.share':
48 {'URL': 'http://127.0.0.1:5984/mygpo_podcastlists'},
50 'mygpo.podcastlists':
51 {'URL': 'http://127.0.0.1:5984/mygpo_podcastlists'},
53 'mygpo.categories':
54 {'URL': 'http://127.0.0.1:5984/mygpo_categories'},
56 'mygpo.userdata':
57 {'URL': 'http://127.0.0.1:5984/mygpo_userdata'},
60 # Maps design documents to databases. The keys correspond to the directories in
61 # mygpo/couch/, the values are the app labels which are mapped to the actual
62 # databases in COUCHDB_DATABASES. This indirect mapping is used because
63 # COUCHDB_DATABASES is likely to be overwritten in settings_prod.py while
64 # COUCHDB_DDOC_MAPPING is most probably not overwritten.
65 COUCHDB_DDOC_MAPPING = {
66 'categories': 'categories',
67 'userdata': 'userdata',
68 'users': 'users',
71 # Local time zone for this installation. Choices can be found here:
72 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
73 # although not all choices may be available on all operating systems.
74 # If running in a Windows environment this must be set to the same as your
75 # system time zone.
76 TIME_ZONE = 'UTC'
78 # Language code for this installation. All choices can be found here:
79 # http://www.i18nguy.com/unicode/language-identifiers.html
80 LANGUAGE_CODE = 'en-us'
82 SITE_ID = 1
84 # If you set this to False, Django will make some optimizations so as not
85 # to load the internationalization machinery.
86 USE_I18N = True
88 STATIC_ROOT = 'staticfiles'
89 STATIC_URL = '/media/'
91 STATICFILES_DIRS = (
92 os.path.abspath(os.path.join(BASE_DIR, '..', 'htdocs', 'media')),
95 # List of callables that know how to import templates from various sources.
96 TEMPLATE_LOADERS = (
97 'django.template.loaders.app_directories.Loader',
100 MIDDLEWARE_CLASSES = (
101 'django.middleware.cache.UpdateCacheMiddleware',
102 'django.middleware.common.CommonMiddleware',
103 'django.middleware.csrf.CsrfViewMiddleware',
104 'django.middleware.cache.FetchFromCacheMiddleware',
105 'django.contrib.sessions.middleware.SessionMiddleware',
106 'django.contrib.auth.middleware.AuthenticationMiddleware',
107 'django.middleware.locale.LocaleMiddleware',
108 'django.contrib.messages.middleware.MessageMiddleware',
111 ROOT_URLCONF = 'mygpo.urls'
113 TEMPLATE_DIRS = ()
115 INSTALLED_APPS = (
116 'django.contrib.contenttypes', # unused, but tests fail otherwise (?)
117 'django.contrib.messages',
118 'django.contrib.admin',
119 'django.contrib.humanize',
120 'django.contrib.auth',
121 'django.contrib.sessions',
122 'django.contrib.staticfiles',
123 'djcelery',
124 'mygpo.core',
125 'mygpo.podcasts',
126 'mygpo.chapters',
127 'mygpo.search',
128 'mygpo.users',
129 'mygpo.api',
130 'mygpo.web',
131 'mygpo.publisher',
132 'mygpo.subscriptions',
133 'mygpo.history',
134 'mygpo.favorites',
135 'mygpo.data',
136 'mygpo.userfeeds',
137 'mygpo.suggestions',
138 'mygpo.directory',
139 'mygpo.maintenance',
140 'mygpo.share',
141 'mygpo.administration',
142 'mygpo.pubsub',
143 'mygpo.db.couchdb',
146 try:
147 import debug_toolbar
148 INSTALLED_APPS += ('debug_toolbar', )
150 except ImportError:
151 print >> sys.stderr, 'Could not load django-debug-toolbar'
154 TEST_EXCLUDE = (
155 'django',
156 'couchdbkit',
159 TEST_RUNNER='mygpo.test.MygpoTestSuiteRunner'
161 ACCOUNT_ACTIVATION_DAYS = 7
163 AUTHENTICATION_BACKENDS = (
164 'django.contrib.auth.backends.ModelBackend',
165 'mygpo.web.auth.EmailAuthenticationBackend',
168 SESSION_ENGINE = "django.contrib.sessions.backends.cached_db"
170 # TODO: use (default) JSON serializer for security
171 # this would currently fail as we're (de)serializing datetime objects
172 # https://docs.djangoproject.com/en/1.5/topics/http/sessions/#session-serialization
173 SESSION_SERIALIZER = 'django.contrib.sessions.serializers.PickleSerializer'
176 from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS
178 TEMPLATE_CONTEXT_PROCESSORS += (
179 "mygpo.web.google.analytics",
180 "mygpo.web.google.adsense",
182 # make the debug variable available in templates
183 # https://docs.djangoproject.com/en/dev/ref/templates/api/#django-core-context-processors-debug
184 "django.core.context_processors.debug",
186 # required so that the request obj can be accessed from templates.
187 # this is used to direct users to previous page after login
188 'django.core.context_processors.request',
191 MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage'
193 USER_CLASS = 'mygpo.users.models.User'
195 LOGIN_URL = '/login/'
197 CSRF_FAILURE_VIEW='mygpo.web.views.security.csrf_failure'
200 # The following entries should be set in settings_prod.py
201 DEFAULT_FROM_EMAIL = ''
202 SECRET_KEY = ''
203 GOOGLE_ANALYTICS_PROPERTY_ID=''
204 DIRECTORY_EXCLUDED_TAGS = ()
205 FLICKR_API_KEY = ''
207 MAINTENANCE = os.path.exists(os.path.join(BASE_DIR, 'MAINTENANCE'))
210 LOGGING = {
211 'version': 1,
212 'disable_existing_loggers': True,
213 'formatters': {
214 'verbose': {
215 'format': '%(asctime)s %(name)s %(levelname)s %(message)s',
218 'filters': {
219 'require_debug_false': {
220 '()': 'django.utils.log.RequireDebugFalse'
223 'handlers': {
224 'console':{
225 'level': 'DEBUG',
226 'class': 'logging.StreamHandler',
227 'formatter': 'verbose'
229 'mail_admins': {
230 'level': 'ERROR',
231 'filters': ['require_debug_false'],
232 'class': 'django.utils.log.AdminEmailHandler'
235 'loggers': {
236 'django': {
237 'handlers': ['console'],
238 'propagate': True,
239 'level': 'WARN',
241 'mygpo': {
242 'handlers': ['console'],
243 'level': 'INFO',
245 'celery': {
246 'handlers': ['console'],
247 'level': 'DEBUG',
252 # minimum number of subscribers a podcast must have to be assigned a slug
253 PODCAST_SLUG_SUBSCRIBER_LIMIT = 10
255 # minimum number of subscribers that a podcast needs to "push" one of its
256 # categories to the top
257 MIN_SUBSCRIBERS_CATEGORY=10
259 # maximum number of episode actions that the API processes immediatelly before
260 # returning the response. Larger requests will be handled in background.
261 # Handler can be set to None to disable
262 API_ACTIONS_MAX_NONBG=100
263 API_ACTIONS_BG_HANDLER='mygpo.api.tasks.episode_actions_celery_handler'
266 ADSENSE_CLIENT = ''
267 ADSENSE_SLOT_BOTTOM = ''
269 # enabled access to staff-only areas with ?staff=<STAFF_TOKEN>
270 STAFF_TOKEN = None
272 # Flattr settings -- available after you register your app
273 FLATTR_KEY = ''
274 FLATTR_SECRET = ''
276 # Flattr thing of the webservice. Will be flattr'd when a user sets the "Auto-Flattr gpodder.net" option
277 FLATTR_MYGPO_THING='https://flattr.com/submit/auto?user_id=stefankoegl&url=http://gpodder.net'
279 # The User-Agent string used for outgoing HTTP requests
280 USER_AGENT = 'gpodder.net (+https://github.com/gpodder/mygpo)'
282 # Base URL of the website that is used if the actually used parameters is not
283 # available. Request handlers, for example, can access the requested domain.
284 # Code that runs in background can not do this, and therefore requires a
285 # default value. This should be set to something like 'http://example.com'
286 DEFAULT_BASE_URL = ''
289 ### Celery
291 BROKER_URL='redis://localhost'
292 CELERY_RESULT_BACKEND='redis://localhost'
294 CELERY_SEND_TASK_ERROR_EMAILS = True,
295 ADMINS=ADMINS,
296 SERVER_EMAIL = "no-reply@example.com",
299 ### Google API
301 GOOGLE_CLIENT_ID=''
302 GOOGLE_CLIENT_SECRET=''
304 # URL where users of the site can get support
305 SUPPORT_URL=''
308 # Elasticsearch settings
310 ELASTICSEARCH_SERVER = os.getenv('ELASTICSEARCH_SERVER', '127.0.0.1:9200')
311 ELASTICSEARCH_INDEX = os.getenv('ELASTICSEARCH_INDEX', 'mygpo')
312 ELASTICSEARCH_TIMEOUT = float(os.getenv('ELASTICSEARCH_TIMEOUT', '2'))
314 # time for how long an activation is valid; after that, an unactivated user
315 # will be deleted
316 ACTIVATION_VALID_DAYS = int(os.getenv('ACTIVATION_VALID_DAYS', 10))
318 import sys
319 if 'test' in sys.argv:
320 SECRET_KEY = 'test'
323 INTERNAL_IPS = os.getenv('INTERNAL_IPS', '').split()
325 try:
326 from settings_prod import *
327 except ImportError, e:
328 import sys
329 print >> sys.stderr, 'create settings_prod.py with your customized settings'