settings_base.py 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. import os
  2. # Board address
  3. BOARD_ADDRESS = 'http://127.0.0.1:8000/'
  4. # Allowed hosts
  5. ALLOWED_HOSTS = ['*']
  6. # Admin control panel path
  7. # Leave this setting empty
  8. ADMIN_PATH = ''
  9. # Enable mobile subdomain for mobile stuff
  10. MOBILE_SUBDOMAIN = ''
  11. # Templates used by mobile version
  12. MOBILE_TEMPLATES = ''
  13. # Default format of Misago generated HTML
  14. OUTPUT_FORMAT = 'html5'
  15. # Default avatar sizes
  16. # Those are avatar sizes Misago generates images for
  17. # Remember to run "genavatars" command when you change this setting!
  18. AVATAR_SIZES = (125, 100, 80, 60, 40, 24)
  19. # Default Gravatar
  20. # See for explanation: https://gravatar.com/site/implement/images/
  21. # Leave empty for classic blue "G" av
  22. GRAVATAR_DEFAULT = ''
  23. # Allow usernames to contain diacritics
  24. UNICODE_USERNAMES = True
  25. # Default anti-flood delay (seconds)
  26. FLOOD_DELAY = 35
  27. # Orphan attachments limit
  28. # Attachment is considered orphan if its not assigned to any post
  29. # It's possible to spam orphans via repeately opening new reply form and uploading files, those limits
  30. # act as countermeasure to such form of attack
  31. ORPHAN_ATTACHMENTS_LIMIT = 32
  32. # If you set this to False, Django will make some optimizations so as not
  33. # to load the internationalization machinery.
  34. USE_I18N = True
  35. # If you set this to False, Django will not format dates, numbers and
  36. # calendars according to the current locale.
  37. USE_L10N = True
  38. # If you set this to False, Django will not use timezone-aware datetimes.
  39. USE_TZ = True
  40. # List of directories that contain Misago locale files
  41. # Defautly set Django to look for Misago translations in misago/locale directory
  42. LOCALE_PATHS = (
  43. ('%slocale%s' % (os.path.dirname(__file__) + os.sep, os.sep)),
  44. )
  45. # Catch-all e-mail address
  46. # If DEBUG_MODE is on, all emails will be sent to this address instead of real recipient.
  47. CATCH_ALL_EMAIL_ADDRESS = ''
  48. # Forums and threads read tracker length (days)
  49. # Enter 0 to turn tracking off
  50. # The bigger the number, then longer tracker keeps threads reads
  51. # information and the more costful it is to track reads
  52. READS_TRACKER_LENGTH = 7
  53. # Min. number of days between synchronisating member profiles
  54. # Allows you to keep your member profiles up to date, enter 0 to never sync
  55. PROFILES_SYNC_FREQUENCY = 7
  56. # Heartbeat Path for crons
  57. # Use this path if you wish to keep Misago alive using separate cron
  58. # By quering this path from your cron you'll keep Misago's base clean
  59. # Leave empty if you don't use Heartbeat cron
  60. HEARTBEAT_PATH = ''
  61. # List of finder classes that know how to find static files in
  62. # various locations.
  63. STATICFILES_FINDERS = (
  64. 'django.contrib.staticfiles.finders.FileSystemFinder',
  65. 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
  66. )
  67. # List of callables that know how to import templates from various sources.
  68. TEMPLATE_LOADERS = (
  69. 'django_jinja.loaders.AppLoader',
  70. 'django_jinja.loaders.FileSystemLoader',
  71. )
  72. # Template extensions that will cause Jinja2 to be used
  73. DEFAULT_JINJA2_TEMPLATE_EXTENSION = ('.html', '.txt')
  74. # Context processors
  75. TEMPLATE_CONTEXT_PROCESSORS = (
  76. 'django.core.context_processors.debug',
  77. 'django.core.context_processors.i18n',
  78. 'django.core.context_processors.media',
  79. 'django.core.context_processors.static',
  80. 'django.core.context_processors.tz',
  81. 'django.contrib.messages.context_processors.messages',
  82. 'misago.context_processors.common',
  83. 'misago.context_processors.admin',
  84. )
  85. # Template middlewares
  86. TEMPLATE_MIDDLEWARES = ()
  87. # Jinja2 Template Extensions
  88. JINJA2_EXTENSIONS = (
  89. 'jinja2.ext.do',
  90. )
  91. # List of application middlewares
  92. MIDDLEWARE_CLASSES = (
  93. 'misago.middleware.thread.ThreadMiddleware',
  94. 'misago.middleware.stopwatch.StopwatchMiddleware',
  95. 'misago.middleware.heartbeat.HeartbeatMiddleware',
  96. 'debug_toolbar.middleware.DebugToolbarMiddleware',
  97. 'misago.middleware.cookiejar.CookieJarMiddleware',
  98. 'misago.middleware.theme.ThemeMiddleware',
  99. 'misago.middleware.firewalls.FirewallMiddleware',
  100. 'misago.middleware.crawlers.DetectCrawlerMiddleware',
  101. 'misago.middleware.session.SessionMiddleware',
  102. 'misago.middleware.bruteforce.JamMiddleware',
  103. 'misago.middleware.csrf.CSRFMiddleware',
  104. 'misago.middleware.banning.BanningMiddleware',
  105. 'misago.middleware.messages.MessagesMiddleware',
  106. 'misago.middleware.user.UserMiddleware',
  107. 'misago.middleware.mailsqueue.MailsQueueMiddleware',
  108. 'misago.middleware.acl.ACLMiddleware',
  109. 'misago.middleware.privatethreads.PrivateThreadsMiddleware',
  110. 'django.middleware.common.CommonMiddleware',
  111. )
  112. # List of application permission providers
  113. PERMISSION_PROVIDERS = (
  114. 'misago.acl.permissions.usercp',
  115. 'misago.acl.permissions.search',
  116. 'misago.acl.permissions.users',
  117. 'misago.acl.permissions.forums',
  118. 'misago.acl.permissions.threads',
  119. 'misago.acl.permissions.privatethreads',
  120. 'misago.acl.permissions.reports',
  121. 'misago.acl.permissions.special',
  122. )
  123. # List of UserCP extensions
  124. USERCP_EXTENSIONS = (
  125. 'misago.apps.usercp.options',
  126. 'misago.apps.usercp.avatar',
  127. 'misago.apps.usercp.signature',
  128. 'misago.apps.usercp.credentials',
  129. 'misago.apps.usercp.username',
  130. )
  131. # List of User Profile extensions
  132. PROFILE_EXTENSIONS = (
  133. 'misago.apps.profiles.posts',
  134. 'misago.apps.profiles.threads',
  135. 'misago.apps.profiles.follows',
  136. 'misago.apps.profiles.followers',
  137. 'misago.apps.profiles.details',
  138. )
  139. # List of User Model relations that should be loaded by session handler
  140. USER_EXTENSIONS_PRELOAD = ()
  141. # List of User Model relations that should be loaded when displaying users profiles
  142. PROFILE_EXTENSIONS_PRELOAD = ()
  143. # List of Markdown Extensions
  144. MARKDOWN_EXTENSIONS = (
  145. 'misago.markdown.extensions.strikethrough.StrikethroughExtension',
  146. 'misago.markdown.extensions.quotes.QuoteTitlesExtension',
  147. 'misago.markdown.extensions.mentions.MentionsExtension',
  148. 'misago.markdown.extensions.magiclinks.MagicLinksExtension',
  149. 'misago.markdown.extensions.cleanlinks.CleanLinksExtension',
  150. 'misago.markdown.extensions.shorthandimgs.ShorthandImagesExtension',
  151. # Uncomment for EXPERIMENTAL BBCode support
  152. #'misago.markdown.extensions.bbcodes.BBCodesExtension',
  153. # Uncomment for emoji support, requires emoji directory in static dir.
  154. #'misago.markdown.extensions.emoji.EmojiExtension',
  155. )
  156. # Name of root urls configuration
  157. ROOT_URLCONF = 'misago.urls'
  158. #Installed applications
  159. INSTALLED_APPS = (
  160. # Applications that have no dependencies first!
  161. 'south', # Database schema building and updating
  162. 'django.contrib.staticfiles',
  163. 'django.contrib.humanize',
  164. 'django_jinja', # Jinja2 integration
  165. 'django_jinja.contrib._humanize', # Some Django filters
  166. 'floppyforms', # Better forms
  167. 'mptt', # Modified Pre-order Tree Transversal - allows us to nest forums
  168. 'haystack', # Search engines bridge
  169. 'debug_toolbar', # Debug toolbar'
  170. 'misago', # Misago Forum App
  171. )
  172. # Stopwatch target file
  173. STOPWATCH_LOG = ''
  174. # IP's that can see debug toolbar
  175. INTERNAL_IPS = ('127.0.0.1', '::1')
  176. # Debug toolbar config
  177. DEBUG_TOOLBAR_CONFIG = {
  178. 'INTERCEPT_REDIRECTS': False
  179. }
  180. # List panels displayed by toolbar
  181. DEBUG_TOOLBAR_PANELS = (
  182. 'debug_toolbar.panels.timer.TimerDebugPanel',
  183. 'debug_toolbar.panels.sql.SQLDebugPanel',
  184. 'debug_toolbar.panels.request_vars.RequestVarsDebugPanel',
  185. 'misago.acl.panels.MisagoACLDebugPanel',
  186. 'debug_toolbar.panels.headers.HeaderDebugPanel',
  187. 'debug_toolbar.panels.template.TemplateDebugPanel',
  188. 'debug_toolbar.panels.settings_vars.SettingsVarsDebugPanel',
  189. 'debug_toolbar.panels.signals.SignalDebugPanel',
  190. 'debug_toolbar.panels.logger.LoggingPanel',
  191. 'debug_toolbar.panels.version.VersionDebugPanel',
  192. )
  193. # Turn off caching
  194. CACHES = {
  195. 'default': {
  196. 'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
  197. }
  198. }
  199. # Use oldchool serializer
  200. SESSION_SERIALIZER = 'django.contrib.sessions.serializers.PickleSerializer'
  201. # A sample logging configuration. The only tangible logging
  202. # performed by this configuration is to send an email to
  203. # the site admins on every HTTP 500 error when DEBUG=False.
  204. # See http://docs.djangoproject.com/en/dev/topics/logging for
  205. # more details on how to customize your logging configuration.
  206. LOGGING = {
  207. 'version': 1,
  208. 'disable_existing_loggers': False,
  209. 'filters': {
  210. 'require_debug_false': {
  211. '()': 'django.utils.log.RequireDebugFalse'
  212. }
  213. },
  214. 'handlers': {
  215. 'mail_admins': {
  216. 'level': 'ERROR',
  217. 'filters': ['require_debug_false'],
  218. 'class': 'django.utils.log.AdminEmailHandler'
  219. }
  220. },
  221. 'loggers': {
  222. 'django.request': {
  223. 'handlers': ['mail_admins'],
  224. 'level': 'ERROR',
  225. 'propagate': True,
  226. },
  227. }
  228. }
  229. # Create copy of installed apps list
  230. # South overrides INSTALLED_APPS list with custom one
  231. # that doesn't contain apps without models when it
  232. # runs its own syncdb
  233. # Misago's loaddata command requires complete list of
  234. # installed apps in order to work correctly
  235. import copy
  236. INSTALLED_APPS_COMPLETE = copy.copy(INSTALLED_APPS)