defaults.py 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. """
  2. Misago default settings
  3. This fille sets everything Misago needs to run.
  4. If you want to add custom app, middleware or path, please update setting vallue
  5. defined in this file instead of copying setting from here to your settings.py.
  6. Yes:
  7. #yourproject/settings.py
  8. INSTALLED_APPS += (
  9. 'myawesomeapp',
  10. )
  11. No:
  12. #yourproject/settings.py
  13. INSTALLED_APPS = (
  14. 'django.contrib.admin',
  15. 'django.contrib.auth',
  16. 'misago.core',
  17. 'misago.conf',
  18. ...
  19. 'myawesomeapp',
  20. )
  21. """
  22. # Build paths inside the project like this: os.path.join(MISAGO_BASE_DIR, ...)
  23. import os
  24. MISAGO_BASE_DIR = os.path.dirname(os.path.dirname(__file__))
  25. # Assets Pipeline
  26. # See http://django-pipeline.readthedocs.org/en/latest/configuration.html
  27. PIPELINE_CSS = {
  28. 'misago': {
  29. 'source_filenames': (
  30. 'misago/css/style.less',
  31. ),
  32. 'output_filename': 'misago.css',
  33. },
  34. 'misago_admin': {
  35. 'source_filenames': (
  36. 'misago/admin/css/style.less',
  37. ),
  38. 'output_filename': 'misago_admin.css',
  39. },
  40. }
  41. PIPELINE_JS = {
  42. 'misago': {
  43. 'source_filenames': (
  44. 'misago/js/jquery.js',
  45. 'misago/js/bootstrap.js',
  46. 'misago/js/moment.min.js',
  47. 'misago/js/tinycon.min.js',
  48. 'misago/js/misago-dom.js',
  49. 'misago/js/misago-timestamps.js',
  50. 'misago/js/misago-tooltips.js',
  51. 'misago/js/misago-yesnoswitch.js',
  52. 'misago/js/misago-alerts.js',
  53. 'misago/js/misago-ajax.js',
  54. 'misago/js/misago-uiserver.js',
  55. 'misago/js/misago-notifications.js',
  56. 'misago/js/misago-threads-lists.js',
  57. ),
  58. 'output_filename': 'misago.js',
  59. },
  60. 'misago_editor': {
  61. 'source_filenames': (
  62. 'misago/js/jquery.autosize.js',
  63. 'misago/js/misago-editor.js',
  64. ),
  65. 'output_filename': 'misago-editor.js',
  66. },
  67. 'misago_admin': {
  68. 'source_filenames': (
  69. 'misago/admin/js/jquery.js',
  70. 'misago/admin/js/bootstrap.js',
  71. 'misago/admin/js/moment.min.js',
  72. 'misago/admin/js/bootstrap-datetimepicker.min.js',
  73. 'misago/admin/js/misago-timestamps.js',
  74. 'misago/admin/js/misago-tooltips.js',
  75. 'misago/admin/js/misago-tables.js',
  76. 'misago/admin/js/misago-yesnoswitch.js',
  77. ),
  78. 'output_filename': 'misago_admin.js',
  79. },
  80. }
  81. STATICFILES_STORAGE = 'pipeline.storage.PipelineStorage'
  82. PIPELINE_COMPILERS = (
  83. 'pipeline.compilers.less.LessCompiler',
  84. )
  85. PIPELINE_CSS_COMPRESSOR = 'pipeline.compressors.yuglify.YuglifyCompressor'
  86. PIPELINE_JS_COMPRESSOR = 'pipeline.compressors.yuglify.YuglifyCompressor'
  87. # Application definition
  88. INSTALLED_APPS = (
  89. 'django.contrib.admin',
  90. # Keep misago.users above django.contrib.auth
  91. # so our management commands take precedence over theirs
  92. 'misago.users',
  93. 'django.contrib.auth',
  94. 'django.contrib.contenttypes',
  95. 'django.contrib.sessions',
  96. 'django.contrib.messages',
  97. 'django.contrib.staticfiles',
  98. 'django.contrib.humanize',
  99. 'debug_toolbar',
  100. 'pipeline',
  101. 'crispy_forms',
  102. 'mptt',
  103. 'misago.admin',
  104. 'misago.acl',
  105. 'misago.core',
  106. 'misago.conf',
  107. 'misago.markup',
  108. 'misago.notifications',
  109. 'misago.legal',
  110. 'misago.forums',
  111. 'misago.threads',
  112. 'misago.readtracker',
  113. 'misago.faker',
  114. )
  115. MIDDLEWARE_CLASSES = (
  116. 'misago.users.middleware.AvatarServerMiddleware',
  117. 'misago.users.middleware.RealIPMiddleware',
  118. 'django.contrib.sessions.middleware.SessionMiddleware',
  119. 'django.middleware.common.CommonMiddleware',
  120. 'django.middleware.csrf.CsrfViewMiddleware',
  121. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  122. 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
  123. 'misago.users.middleware.UserMiddleware',
  124. 'django.contrib.messages.middleware.MessageMiddleware',
  125. 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  126. 'misago.core.middleware.exceptionhandler.ExceptionHandlerMiddleware',
  127. 'misago.users.middleware.OnlineTrackerMiddleware',
  128. 'misago.admin.middleware.AdminAuthMiddleware',
  129. 'misago.core.middleware.threadstore.ThreadStoreMiddleware',
  130. )
  131. TEMPLATE_CONTEXT_PROCESSORS = (
  132. 'django.contrib.auth.context_processors.auth',
  133. 'django.core.context_processors.debug',
  134. 'django.core.context_processors.i18n',
  135. 'django.core.context_processors.media',
  136. 'django.core.context_processors.static',
  137. 'django.core.context_processors.tz',
  138. 'django.contrib.messages.context_processors.messages',
  139. 'misago.core.context_processors.site_address',
  140. 'misago.conf.context_processors.settings',
  141. 'misago.users.context_processors.sites_links',
  142. )
  143. MISAGO_ACL_EXTENSIONS = (
  144. 'misago.users.permissions.account',
  145. 'misago.users.permissions.profiles',
  146. 'misago.users.permissions.warnings',
  147. 'misago.users.permissions.moderation',
  148. 'misago.users.permissions.delete',
  149. 'misago.forums.permissions',
  150. 'misago.threads.permissions',
  151. )
  152. MISAGO_MARKUP_EXTENSIONS = ()
  153. MISAGO_POSTING_MIDDLEWARES = (
  154. 'misago.threads.posting.reply.ReplyFormMiddleware',
  155. 'misago.threads.posting.threadlabel.ThreadLabelFormMiddleware',
  156. 'misago.threads.posting.threadweight.ThreadWeightFormMiddleware',
  157. 'misago.threads.posting.threadclose.ThreadCloseFormMiddleware',
  158. 'misago.threads.posting.recordedit.RecordEditMiddleware',
  159. 'misago.threads.posting.updatestats.UpdateStatsMiddleware',
  160. # Note: always keep SaveChangesMiddleware middleware last one
  161. 'misago.threads.posting.savechanges.SaveChangesMiddleware',
  162. )
  163. # Register Misago directories
  164. LOCALE_PATHS = (
  165. os.path.join(MISAGO_BASE_DIR, 'locale'),
  166. )
  167. STATICFILES_DIRS = (
  168. os.path.join(MISAGO_BASE_DIR, 'static'),
  169. )
  170. TEMPLATE_DIRS = (
  171. os.path.join(MISAGO_BASE_DIR, 'templates'),
  172. )
  173. # Internationalization
  174. USE_I18N = True
  175. USE_L10N = True
  176. USE_TZ = True
  177. TIME_ZONE = 'UTC'
  178. # Misago specific date formats
  179. # https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
  180. MISAGO_COMPACT_DATE_FORMAT_DAY_MONTH = 'j M'
  181. MISAGO_COMPACT_DATE_FORMAT_DAY_MONTH_YEAR = 'M \'y'
  182. # Use Misago CSRF Failure Page
  183. CSRF_FAILURE_VIEW = 'misago.core.errorpages.csrf_failure'
  184. # Use Misago authentication
  185. AUTH_USER_MODEL = 'misago_users.User'
  186. AUTHENTICATION_BACKENDS = (
  187. 'misago.users.authbackends.MisagoBackend',
  188. )
  189. # How many e-mails should be sent in single step.
  190. # This is used for conserving memory usage when mailing many users at same time
  191. MISAGO_MAILER_BATCH_SIZE = 20
  192. # Auth paths
  193. LOGIN_REDIRECT_URL = 'misago:index'
  194. LOGIN_URL = 'misago:login'
  195. LOGOUT_URL = 'misago:logout'
  196. # Misago Admin Path
  197. # Omit starting and trailing slashes
  198. # To disable Misago admin, empty this value
  199. MISAGO_ADMIN_PATH = 'admincp'
  200. # Admin urls namespaces that Misago's AdminAuthMiddleware should protect
  201. MISAGO_ADMIN_NAMESPACES = (
  202. 'admin',
  203. 'misago:admin',
  204. )
  205. # How long (in minutes) since previous request to admin namespace should
  206. # admin session last.
  207. MISAGO_ADMIN_SESSION_EXPIRATION = 60
  208. # Max age of notifications in days
  209. # Notifications older than this are deleted
  210. # On very active forums its better to keep this smaller
  211. MISAGO_NOTIFICATIONS_MAX_AGE = 40
  212. # Function used for generating individual avatar for user
  213. MISAGO_DYNAMIC_AVATAR_DRAWER = 'misago.users.avatars.dynamic.draw_default'
  214. # For which sizes avatars should be cached?
  215. # Keep sizes ordered from greatest to smallest
  216. MISAGO_AVATARS_SIZES = (400, 200, 150, 100, 64, 50, 30, 20)
  217. # Path to avatar server
  218. # This path is used to detect avatar requests, which bypass most of
  219. # Request/Response processing for performance reasons
  220. MISAGO_AVATAR_SERVER_PATH = '/user-avatar'
  221. # Controls max age in days of items that Misago has to process to make rankings
  222. # Used for active posters and most liked users lists
  223. # If your forum runs out of memory when trying to generate users rankings list
  224. # or you want those to be more dynamic, give this setting lower value
  225. # You don't have to be overzelous with this as user rankings are cached for 24h
  226. MISAGO_RANKING_LENGTH = 30
  227. # Controls max number of items displayed on ranked lists
  228. MISAGO_RANKING_SIZE = 30
  229. # Controls amount of data used in resolving read/unread states of threads and
  230. # forums. Any activity older than number of days below is assumed to be read
  231. # and not tracked anymore. Active forums can try lowering this value while
  232. # less active ones may wish to increase this number
  233. MISAGO_READ_RECORD_LENGTH = 28
  234. # X-Sendfile
  235. # X-Sendfile is feature provided by Http servers that allows web apps to
  236. # delegate serving files over to the better performing server instead of
  237. # doing it within app.
  238. # If your server supports X-Sendfile or its variation, enter header name here.
  239. # For example if you are using Nginx with X-accel enabled, set this setting
  240. # to "X-Accel-Redirect".
  241. # Leave this setting empty to Django fallback instead
  242. MISAGO_SENDFILE_HEADER = ''
  243. # Allows you to use location feature of your Http server
  244. # For example, if you have internal location /mymisago/avatar_cache/
  245. # that points at /home/myweb/misagoforum/avatar_cache/, set this setting
  246. # to "mymisago".
  247. MISAGO_SENDFILE_LOCATIONS_PATH = ''
  248. # Default forms templates
  249. CRISPY_TEMPLATE_PACK = 'bootstrap3'
  250. # Register Misago debug panels
  251. DEBUG_TOOLBAR_PANELS = (
  252. 'debug_toolbar.panels.versions.VersionsPanel',
  253. 'debug_toolbar.panels.timer.TimerPanel',
  254. 'debug_toolbar.panels.settings.SettingsPanel',
  255. 'debug_toolbar.panels.headers.HeadersPanel',
  256. 'debug_toolbar.panels.request.RequestPanel',
  257. 'debug_toolbar.panels.sql.SQLPanel',
  258. 'misago.acl.panels.MisagoACLPanel',
  259. 'debug_toolbar.panels.staticfiles.StaticFilesPanel',
  260. 'debug_toolbar.panels.templates.TemplatesPanel',
  261. 'debug_toolbar.panels.cache.CachePanel',
  262. 'debug_toolbar.panels.signals.SignalsPanel',
  263. 'debug_toolbar.panels.logging.LoggingPanel',
  264. )