settings_base.py 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  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 = False
  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.warnings',
  122. 'misago.acl.permissions.destroyusers',
  123. 'misago.acl.permissions.acpaccess',
  124. )
  125. # List of UserCP extensions
  126. USERCP_EXTENSIONS = (
  127. 'misago.apps.usercp.options',
  128. 'misago.apps.usercp.avatar',
  129. 'misago.apps.usercp.signature',
  130. 'misago.apps.usercp.credentials',
  131. 'misago.apps.usercp.username',
  132. )
  133. # List of User Profile extensions
  134. PROFILE_EXTENSIONS = (
  135. 'misago.apps.profiles.posts',
  136. 'misago.apps.profiles.threads',
  137. 'misago.apps.profiles.follows',
  138. 'misago.apps.profiles.followers',
  139. 'misago.apps.profiles.warnings',
  140. 'misago.apps.profiles.details',
  141. )
  142. # List of User Model relations that should be loaded by session handler
  143. USER_EXTENSIONS_PRELOAD = ()
  144. # List of User Model relations that should be loaded when displaying users profiles
  145. PROFILE_EXTENSIONS_PRELOAD = ()
  146. # List of Markdown Extensions
  147. MARKDOWN_EXTENSIONS = (
  148. 'misago.markdown.extensions.strikethrough.StrikethroughExtension',
  149. 'misago.markdown.extensions.quotes.QuoteTitlesExtension',
  150. 'misago.markdown.extensions.mentions.MentionsExtension',
  151. 'misago.markdown.extensions.magiclinks.MagicLinksExtension',
  152. 'misago.markdown.extensions.cleanlinks.CleanLinksExtension',
  153. 'misago.markdown.extensions.shorthandimgs.ShorthandImagesExtension',
  154. # Uncomment for EXPERIMENTAL BBCode support
  155. #'misago.markdown.extensions.bbcodes.BBCodesExtension',
  156. # Uncomment for emoji support, requires emoji directory in static dir.
  157. #'misago.markdown.extensions.emoji.EmojiExtension',
  158. )
  159. # Name of root urls configuration
  160. ROOT_URLCONF = 'misago.urls'
  161. #Installed applications
  162. INSTALLED_APPS = (
  163. # Applications that have no dependencies first!
  164. 'south', # Database schema building and updating
  165. 'django.contrib.staticfiles',
  166. 'django.contrib.humanize',
  167. 'django_jinja', # Jinja2 integration
  168. 'django_jinja.contrib._humanize', # Some Django filters
  169. 'floppyforms', # Better forms
  170. 'mptt', # Modified Pre-order Tree Transversal - allows us to nest forums
  171. 'haystack', # Search engines bridge
  172. 'debug_toolbar', # Debug toolbar'
  173. 'misago', # Misago Forum App
  174. )
  175. # Stopwatch target file
  176. STOPWATCH_LOG = ''
  177. # IP's that can see debug toolbar
  178. INTERNAL_IPS = ('127.0.0.1', '::1')
  179. # Debug toolbar config
  180. DEBUG_TOOLBAR_CONFIG = {
  181. 'INTERCEPT_REDIRECTS': False
  182. }
  183. # List panels displayed by toolbar
  184. DEBUG_TOOLBAR_PANELS = [
  185. 'debug_toolbar.panels.versions.VersionsPanel',
  186. 'debug_toolbar.panels.timer.TimerPanel',
  187. 'debug_toolbar.panels.settings.SettingsPanel',
  188. 'debug_toolbar.panels.headers.HeadersPanel',
  189. 'debug_toolbar.panels.request.RequestPanel',
  190. 'debug_toolbar.panels.sql.SQLPanel',
  191. 'debug_toolbar.panels.staticfiles.StaticFilesPanel',
  192. 'debug_toolbar.panels.templates.TemplatesPanel',
  193. 'debug_toolbar.panels.cache.CachePanel',
  194. 'misago.acl.panels.MisagoACLDebugPanel',
  195. 'debug_toolbar.panels.signals.SignalsPanel',
  196. 'debug_toolbar.panels.logging.LoggingPanel',
  197. 'debug_toolbar.panels.redirects.RedirectsPanel',
  198. ]
  199. # Turn off caching
  200. CACHES = {
  201. 'default': {
  202. 'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
  203. }
  204. }
  205. # Use oldchool serializer
  206. SESSION_SERIALIZER = 'django.contrib.sessions.serializers.PickleSerializer'
  207. # A sample logging configuration. The only tangible logging
  208. # performed by this configuration is to send an email to
  209. # the site admins on every HTTP 500 error when DEBUG=False.
  210. # See http://docs.djangoproject.com/en/dev/topics/logging for
  211. # more details on how to customize your logging configuration.
  212. LOGGING = {
  213. 'version': 1,
  214. 'disable_existing_loggers': False,
  215. 'filters': {
  216. 'require_debug_false': {
  217. '()': 'django.utils.log.RequireDebugFalse'
  218. }
  219. },
  220. 'handlers': {
  221. 'mail_admins': {
  222. 'level': 'ERROR',
  223. 'filters': ['require_debug_false'],
  224. 'class': 'django.utils.log.AdminEmailHandler'
  225. }
  226. },
  227. 'loggers': {
  228. 'django.request': {
  229. 'handlers': ['mail_admins'],
  230. 'level': 'ERROR',
  231. 'propagate': True,
  232. },
  233. }
  234. }
  235. # Create copy of installed apps list
  236. # South overrides INSTALLED_APPS list with custom one
  237. # that doesn't contain apps without models when it
  238. # runs its own syncdb
  239. # Misago's loaddata command requires complete list of
  240. # installed apps in order to work correctly
  241. import copy
  242. INSTALLED_APPS_COMPLETE = copy.copy(INSTALLED_APPS)