PageRenderTime 65ms CodeModel.GetById 33ms RepoModel.GetById 1ms app.codeStats 0ms

/settings.py

https://github.com/CollabQ/CollabQ
Python | 442 lines | 205 code | 95 blank | 142 comment | 3 complexity | 3f73727e303c8ba723acd6b2c1f186b3 MD5 | raw file
Possible License(s): BSD-3-Clause, Apache-2.0
  1. # Copyright 2009 Google Inc.
  2. # Copyright 2010 http://www.collabq.com
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. import re
  15. import os
  16. import os.path
  17. import sys
  18. # for python 2.6
  19. if sys.version.startswith('2.6'):
  20. import logging
  21. logging.logMultiprocessing = 0
  22. ROOT_PATH = os.path.dirname(__file__)
  23. ###
  24. # Django related settings
  25. ###
  26. DEBUG = False
  27. TEMPLATE_DEBUG = DEBUG
  28. ADMINS = (
  29. ('Jose Maria Zambrana Arze', 'zero.fuxor@gmail.com'),
  30. )
  31. MANAGERS = ADMINS
  32. #POBoxPress owner Settings
  33. # TODO(zero): review this
  34. ADMINS_POBOX = []
  35. CREATE_CHANNELS_FROM_POSTS = False
  36. # This stuff is always going to be the same for an App Engine instance
  37. DATABASE_ENGINE = 'appengine' # 'appengine' is the only supported engine
  38. DATABASE_NAME = '' # Not used with appengine
  39. DATABASE_USER = '' # Not used with appengine
  40. DATABASE_PASSWORD = '' # Not used with appengine
  41. DATABASE_HOST = '' # Not used with appengine
  42. DATABASE_PORT = '' # Not used with appengine
  43. # The appengine_django code doesn't care about the address of memcached
  44. # because it is a built in API for App Engine
  45. CACHE_BACKEND = 'memcached://'
  46. # Local time zone for this installation. Choices can be found here:
  47. # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
  48. # although not all choices may be available on all operating systems.
  49. # If running in a Windows environment this must be set to the same as your
  50. # system time zone.
  51. TIME_ZONE = 'UTC-8'
  52. # Language code for this installation. All choices can be found here:
  53. # http://www.i18nguy.com/unicode/language-identifiers.html
  54. LANGUAGE_CODE = 'en-us'
  55. # If you set this to False, Django will make some optimizations so as not
  56. # to load the internationalization machinery.
  57. USE_I18N = True
  58. # Make this unique, and don't share it with anybody.
  59. SECRET_KEY = '8066e3870fb8eacf192789c415a0a3e8'
  60. # List of callables that know how to import templates from various sources.
  61. TEMPLATE_LOADERS = (
  62. 'django.template.loaders.filesystem.load_template_source',
  63. 'django.template.loaders.app_directories.load_template_source',
  64. # 'django.template.loaders.eggs.load_template_source',
  65. )
  66. MIDDLEWARE_CLASSES = (
  67. 'middleware.domain.DomainMiddleware',
  68. 'middleware.auth.AuthenticationMiddleware',
  69. 'middleware.exception.ExceptionMiddleware',
  70. 'middleware.verify.VerifyInstallMiddleware',
  71. 'middleware.cache.CacheMiddleware',
  72. 'middleware.strip_whitespace.WhitespaceMiddleware',
  73. 'middleware.profile.ProfileMiddleware',
  74. )
  75. ROOT_URLCONF = 'urls'
  76. # The default theme to use
  77. DEFAULT_THEME = 'innogems'
  78. THEME_TEMPLATES = os.path.join(os.path.join(ROOT_PATH, 'templates'), DEFAULT_THEME)
  79. # Where the templates live, you probably don't want to change this unless you
  80. # know what you're doing
  81. TEMPLATE_DIRS = (
  82. THEME_TEMPLATES,
  83. ROOT_PATH,
  84. )
  85. TEMPLATE_CONTEXT_PROCESSORS = (
  86. 'django.core.context_processors.debug',
  87. 'django.core.context_processors.request',
  88. 'common.context_processors.settings',
  89. 'common.context_processors.flash',
  90. 'common.context_processors.components',
  91. )
  92. # Only apps under INSTALLED_APPS will be automatically tested via
  93. # `python manage.py test` and the profiling code takes this list into
  94. # account while filtering calls
  95. INSTALLED_APPS = (
  96. 'appengine_django',
  97. 'common',
  98. 'actor',
  99. 'api',
  100. 'channel',
  101. 'explore',
  102. 'join',
  103. 'flat',
  104. 'login',
  105. 'front',
  106. 'invite',
  107. 'confirm',
  108. 'components',
  109. )
  110. # We override the default test runner so that we can be Totally Awesome
  111. TEST_RUNNER = 'common.test.runner.run_tests'
  112. ####
  113. #
  114. # Below this is custom for CollabQ (not related to Django)
  115. #
  116. ####
  117. # This is a dynamic setting so that we can check whether we have been run
  118. # locally, it is used mainly for making special testing-only tweaks. Ideally
  119. # we wouldn't need this, but the alternatives so far have been tricky.
  120. MANAGE_PY = os.path.exists('manage.py')
  121. # This is the colloquial name for an entry, mostly used for branding purposes
  122. POST_NAME = 'xpress'
  123. # This is the domain where this is installed on App Engine. It will be
  124. # necessary to know this if you plan on enabling SSL for login and join.
  125. APP_ID = 'collabq'
  126. GAE_DOMAIN = '%s.appspot.com' % APP_ID
  127. NS_DOMAIN = GAE_DOMAIN
  128. # Enabling this means we expect to be spending most of our time on a
  129. # Hosted domain
  130. HOSTED_DOMAIN_ENABLED = False
  131. # This is the domain you intend to serve your site from, when using hosted
  132. # domains. If SSL is enabled for login and join those requests will still
  133. # go to the GAE_DOMAIN above.
  134. HOSTED_DOMAIN = 'example.com'
  135. # App Engine requires you to serve with a subdomain
  136. DEFAULT_HOSTED_SUBDOMAIN = 'www'
  137. # DOMAIN will be used wherever a url to this site needs to be created
  138. # NS_DOMAIN will be used as the domain part of actor identifiers.
  139. # Note that changing this once you have deployed the site will likely result
  140. # in catastrophic failure.
  141. if HOSTED_DOMAIN_ENABLED:
  142. #DOMAIN = '%s.%s' % (DEFAULT_HOSTED_SUBDOMAIN, HOSTED_DOMAIN)
  143. DOMAIN = '%s.%s' % (DEFAULT_HOSTED_SUBDOMAIN, HOSTED_DOMAIN)
  144. else:
  145. DOMAIN = GAE_DOMAIN
  146. # Subdomains aren't supported all that nicely by App Engine yet, so you
  147. # probably won't be able to enable WILDCARD_SUBDOMAINS below, but you can
  148. # still set up your app to use some of the static subdomains below.
  149. # Subdomains are ignored unless HOSTED_DOMAIN_ENABLED is True.
  150. SUBDOMAINS_ENABLED = False
  151. WILDCARD_USER_SUBDOMAINS_ENABLED = False
  152. # These are defined as { subdomain : url_conf, ...}
  153. INSTALLED_SUBDOMAINS = {
  154. 'api': 'api.urls', # api-only urlconf
  155. 'm': 'urls', # default urlconf, but allow the subdomain
  156. }
  157. # Enable SSL support for login and join, if using HOSTED_DOMAIN_ENABLED
  158. # this means you will be redirecting through https://GAE_DOMAIN/login
  159. # and https://GAE_DOMAIN/join for those respective actions.
  160. SSL_LOGIN_ENABLED = False
  161. #
  162. # Appearance / Theme
  163. #
  164. #
  165. # Cookie
  166. #
  167. # Cookie settings, pretty self explanatory, you shouldn't need to touch these.
  168. USER_COOKIE = 'user'
  169. PASSWORD_COOKIE = 'password'
  170. COOKIE_DOMAIN = '.%s' % DOMAIN
  171. COOKIE_PATH = '/'
  172. #
  173. # Blog
  174. #
  175. # Do you want /blog to redirect to your blog?
  176. BLOG_ENABLED = False
  177. # Where is your blog?
  178. BLOG_URL = 'http://example.com'
  179. BLOG_FEED_URL = 'http://example.com/feeds'
  180. #
  181. # API
  182. #
  183. # Setting this to True will make the public API accept all requests as being
  184. # from ROOT with no regard to actual authentication.
  185. # Never this set to True on a production site.
  186. API_DISABLE_VERIFICATION = False
  187. # These next three determine which OAuth Signature Methods to allow.
  188. API_ALLOW_RSA_SHA1 = True
  189. API_ALLOW_HMAC_SHA1 = True
  190. API_ALLOW_PLAINTEXT = False
  191. # These three determine whether the ROOT use should be allowed to use these
  192. # methods, if any at all. Setting all of these to False will disable the
  193. # ROOT user from accessing the public API
  194. API_ALLOW_ROOT_RSA_SHA1 = True
  195. API_ALLOW_ROOT_HMAC_SHA1 = True
  196. API_ALLOW_ROOT_PLAINTEXT = False
  197. # OAuth consumer key and secret values
  198. ROOT_TOKEN_KEY = 'ROOT_TOKEN_KEY'
  199. ROOT_TOKEN_SECRET = 'ROOT_TOKEN_SECRET'
  200. ROOT_CONSUMER_KEY = 'ROOT_CONSUMER_KEY'
  201. ROOT_CONSUMER_SECRET = 'ROOT_CONSUMER_SECRET'
  202. # Allow support for legacy API authentication
  203. API_ALLOW_LEGACY_AUTH = False
  204. LEGACY_SECRET_KEY = 'I AM ALSO SECRET'
  205. #
  206. # SMS
  207. #
  208. # Enabling SMS will require a bit more than just making this True.
  209. SMS_ENABLED = False
  210. # Most SMS vendors will provide a service that will post messages to a url
  211. # on your site when an SMS has been received on their end, this setting allows
  212. # you to add a secret value to that must exist in that url to prevent
  213. # malicious use.
  214. SMS_VENDOR_SECRET = 'SMS_VENDOR'
  215. # Valid numbers on which you expect to receive SMS
  216. SMS_TARGET = '00000'
  217. # Whitelist regular expression for allowable mobile-terminated targets
  218. SMS_MT_WHITELIST = re.compile('\+\d+')
  219. # Blacklist regular expression for blocked mobile-terminated targets
  220. SMS_MT_BLACKLIST = None
  221. # Turn on test mode for SMS
  222. SMS_TEST_ONLY = False
  223. # Numbers to use when testing live SMS so you don't spam all your users
  224. SMS_TEST_NUMBERS = []
  225. #
  226. # XMPP / IM
  227. #
  228. # Enabling IM will require a bit more than just making this True.
  229. IM_ENABLED = False
  230. # This is the id (JID) of the IM bot that you will use to communicate with
  231. # users of the IM interface
  232. IM_BOT = 'root@example.com'
  233. # Turn on test mode for IM
  234. IM_TEST_ONLY = False
  235. # JIDs to allow when testing live XMPP so you don't spam all your users
  236. IM_TEST_JIDS = []
  237. # Enable to send plain text messages only. Default is to send both plain
  238. # text and html.
  239. IM_PLAIN_TEXT_ONLY = False
  240. # Truncate entry title in comments. None or 140+ means no truncation.
  241. IM_MAX_LENGTH_OF_ENTRY_TITLES_FOR_COMMENTS = 40
  242. #
  243. # Task Queue
  244. #
  245. # Enabling the queue will allow you to process posts with larger numbers
  246. # of followers but will require you to set up a cron job that will continuously
  247. # ping a special url to make sure the queue gets processed
  248. QUEUE_ENABLED = True
  249. # The secret to use for your cron job that processes your queue
  250. QUEUE_VENDOR_SECRET = 'SECRET'
  251. #
  252. # Throttling Config
  253. #
  254. # This will control the max number of SMS to send over a 30-day period
  255. THROTTLE_SMS_GLOBAL_MONTH = 10000
  256. # Settings for remote services
  257. IMAGE_UPLOAD_ENABLED = False
  258. IMAGE_UPLOAD_URL = 'upload.example.com'
  259. MAX_AVATAR_UPLOAD_KB = 300
  260. # Settings for Google Contacts import
  261. GOOGLE_CONTACTS_IMPORT_ENABLED = False
  262. FEEDS_ENABLED = False
  263. MARK_AS_SPAM_ENABLED = True
  264. PRESS_ENABLED = False
  265. BADGES_ENABLED = True
  266. HIDE_COMMENTS_ENABLED = True
  267. MULTIADMIN_ENABLED = True
  268. PRIVATE_CHANNELS_ENABLED = False
  269. MARKDOWN_ENABLED = False
  270. # Lists nicks of users participating in conversations underneath comment
  271. # areas for posts. Clicking list items inserts @nicks into comment box.
  272. # The list shows a maximum of 25 nicks.
  273. COMMENT_QUICKLINKS_ENABLED = True
  274. # If enabled, adds support for using access keys 1-9 to insert @nicks into
  275. # comment box. Requires COMMENT_QUICKLINKS_ENABLED.
  276. COMMENT_QUICKLINKS_ACCESSKEYS_ENABLED = False
  277. PROFILE_DB = False
  278. # Limit of avatar photo size in kilobytes
  279. MAX_AVATAR_PHOTO_KB = 200
  280. MAX_ACTIVATIONS = 10
  281. # Email Test mode
  282. EMAIL_TEST_ONLY = False
  283. # Allowed email addresses for testing
  284. EMAIL_TEST_ADDRESSES = []
  285. # Email limiting, if this is set it will restrict users to those with
  286. # email addresses in this domain
  287. EMAIL_LIMIT_DOMAIN = None
  288. # Gdata Stuff
  289. GDATA_CONSUMER_KEY = ''
  290. GDATA_CONSUMER_SECRET = ''
  291. def default_email_sender():
  292. try:
  293. return os.environ['DJANGO_DEFAULT_FROM_EMAIL']
  294. except KeyError:
  295. return 'termie@google.com'
  296. DEFAULT_FROM_EMAIL = 'zero.fuxor@gmail.com'
  297. DEFAULT_UNITTEST_TO_EMAIL = 'unittests@example.com'
  298. PROFILING_DATA_PATH = 'profiling/prof_db.csv'
  299. DEFAULT_MEMBERS = []
  300. DEFAULT_TAXONOMY = 'tag_geo'
  301. DEFAULT_TAG = "/%s" % DEFAULT_TAXONOMY
  302. ROOT_TAG = "/%s" % DEFAULT_TAXONOMY
  303. # Set up the settings for the dev server if we are running it
  304. if MANAGE_PY:
  305. try:
  306. from dev_settings import *
  307. except ImportError:
  308. pass
  309. # Allow local overrides, useful for testing during development
  310. try:
  311. from local_settings import *
  312. except ImportError:
  313. pass
  314. # This is the name of the root user of the site
  315. ROOT_NICK = 'root@%s' % NS_DOMAIN
  316. # This is the name of the site that will be used whenever it refers to itself
  317. SITE_NAME = "CollabQ"
  318. TAGLINE = "Open Souce | Enterprise | Social Software"
  319. SITE_DESCRIPTION = "CollabQ community management system"
  320. DEFAULT_CHANNEL = 'support'
  321. POST_NAME = 'Post'
  322. # This is the colloquial name for an entry, mostly used for branding purposes
  323. CHANNEL_TYPES = ['Professional', 'Academic', 'Social']
  324. ENABLE_CHANNELS = False
  325. ENABLE_CHANNEL_TYPES = False
  326. ENABLE_ACCOUNT_TYPE = False
  327. # Twitter
  328. TWITTER_CONSUMER_KEY = ''
  329. TWITTER_CONSUMER_SECRET = ''
  330. # Things to measure to taste
  331. MAX_POST_LENGTH = 200
  332. MAX_COMMENT_LENGTH = MAX_POST_LENGTH
  333. MAX_TWITTER_LENGTH = 140