settings.rst 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934
  1. ========
  2. Settings
  3. ========
  4. Wagtail makes use of the following settings, in addition to :doc:`Django's core settings <ref/settings>`:
  5. Site Name
  6. =========
  7. ``WAGTAIL_SITE_NAME``
  8. ---------------------
  9. .. code-block:: python
  10. WAGTAIL_SITE_NAME = 'Stark Industries Skunkworks'
  11. This is the human-readable name of your Wagtail install which welcomes users upon login to the Wagtail admin.
  12. .. _append_slash:
  13. Append Slash
  14. ============
  15. ``WAGTAIL_APPEND_SLASH``
  16. ------------------------
  17. .. code-block:: python
  18. # Don't add a trailing slash to Wagtail-served URLs
  19. WAGTAIL_APPEND_SLASH = False
  20. Similar to Django's ``APPEND_SLASH``, this setting controls how Wagtail will handle requests that don't end in a trailing slash.
  21. When ``WAGTAIL_APPEND_SLASH`` is ``True`` (default), requests to Wagtail pages which omit a trailing slash will be redirected by Django's :class:`~django.middleware.common.CommonMiddleware` to a URL with a trailing slash.
  22. When ``WAGTAIL_APPEND_SLASH`` is ``False``, requests to Wagtail pages will be served both with and without trailing slashes. Page links generated by Wagtail, however, will not include trailing slashes.
  23. .. note::
  24. If you use the ``False`` setting, keep in mind that serving your pages both with and without slashes may affect search engines' ability to index your site. See `this Google Search Central Blog post`_ for more details.
  25. .. _this Google Search Central Blog post: https://developers.google.com/search/blog/2010/04/to-slash-or-not-to-slash
  26. Search
  27. ======
  28. ``WAGTAILSEARCH_BACKENDS``
  29. --------------------------
  30. .. code-block:: python
  31. WAGTAILSEARCH_BACKENDS = {
  32. 'default': {
  33. 'BACKEND': 'wagtail.search.backends.elasticsearch5',
  34. 'INDEX': 'myapp'
  35. }
  36. }
  37. Define a search backend. For a full explanation, see :ref:`wagtailsearch_backends`.
  38. .. _wagtailsearch_hits_max_age:
  39. ``WAGTAILSEARCH_HITS_MAX_AGE``
  40. ------------------------------
  41. .. code-block:: python
  42. WAGTAILSEARCH_HITS_MAX_AGE = 14
  43. Set the number of days (default 7) that search query logs are kept for; these are used to identify popular search terms for :ref:`promoted search results <editors-picks>`. Queries older than this will be removed by the :ref:`search_garbage_collect` command.
  44. Internationalisation
  45. ====================
  46. Wagtail supports internationalisation of content by maintaining separate trees
  47. of pages for each language.
  48. For a guide on how to enable internationalisation on your site, see the :ref:`configuration guide <enabling_internationalisation>`.
  49. ``WAGTAIL_I18N_ENABLED``
  50. ------------------------
  51. (boolean, default ``False``)
  52. When set to ``True``, Wagtail's internationalisation features will be enabled:
  53. .. code-block:: python
  54. WAGTAIL_I18N_ENABLED = True
  55. .. _wagtail_content_languages_setting:
  56. ``WAGTAIL_CONTENT_LANGUAGES``
  57. -----------------------------
  58. (list, default ``[]``)
  59. A list of languages and/or locales that Wagtail content can be authored in.
  60. For example:
  61. .. code-block:: python
  62. WAGTAIL_CONTENT_LANGUAGES = [
  63. ('en', _("English")),
  64. ('fr', _("French")),
  65. ]
  66. Each item in the list is a 2-tuple containing a language code and a display name.
  67. The language code can either be a language code on its own (such as ``en``, ``fr``),
  68. or it can include a region code (such as ``en-gb``, ``fr-fr``).
  69. You can mix the two formats if you only need to localize in some regions but not others.
  70. This setting follows the same structure of Django's ``LANGUAGES`` setting,
  71. so they can both be set to the same value:
  72. .. code-block:: python
  73. LANGUAGES = WAGTAIL_CONTENT_LANGUAGES = [
  74. ('en-gb', _("English (United Kingdom)")),
  75. ('en-us', _("English (United States)")),
  76. ('es-es', _("Spanish (Spain)")),
  77. ('es-mx', _("Spanish (Mexico)")),
  78. ]
  79. However having them separate allows you to configure many different regions on your site
  80. yet have them share Wagtail content (but defer on things like date formatting, currency, etc):
  81. .. code-block:: python
  82. LANGUAGES = [
  83. ('en', _("English (United Kingdom)")),
  84. ('en-us', _("English (United States)")),
  85. ('es', _("Spanish (Spain)")),
  86. ('es-mx', _("Spanish (Mexico)")),
  87. ]
  88. WAGTAIL_CONTENT_LANGUAGES = [
  89. ('en', _("English")),
  90. ('es', _("Spanish")),
  91. ]
  92. This would mean that your site will respond on the
  93. ``https://www.mysite.com/es/`` and ``https://www.mysite.com/es-MX/`` URLs, but both
  94. of them will serve content from the same "Spanish" tree in Wagtail.
  95. .. note:: ``WAGTAIL_CONTENT_LANGUAGES`` must be a subset of ``LANGUAGES``
  96. Note that all languages that exist in ``WAGTAIL_CONTENT_LANGUAGES``
  97. must also exist in your ``LANGUAGES`` setting. This is so that Wagtail can
  98. generate a live URL to these pages from an untranslated context (e.g. the admin
  99. interface).
  100. Embeds
  101. ======
  102. Wagtail supports generating embed code from URLs to content on an external
  103. providers such as Youtube or Twitter. By default, Wagtail will fetch the embed
  104. code directly from the relevant provider's site using the oEmbed protocol.
  105. Wagtail has a builtin list of the most common providers.
  106. The embeds fetching can be fully configured using the ``WAGTAILEMBEDS_FINDERS``
  107. setting. This is fully documented in :ref:`configuring_embed_finders`.
  108. ``WAGTAILEMBEDS_RESPONSIVE_HTML``
  109. ---------------------------------
  110. .. code-block:: python
  111. WAGTAILEMBEDS_RESPONSIVE_HTML = True
  112. Adds ``class="responsive-object"`` and an inline ``padding-bottom`` style to embeds,
  113. to assist in making them responsive. See :ref:`responsive-embeds` for details.
  114. Dashboard
  115. =========
  116. ``WAGTAILADMIN_RECENT_EDITS_LIMIT``
  117. -----------------------------------
  118. .. code-block:: python
  119. WAGTAILADMIN_RECENT_EDITS_LIMIT = 5
  120. This setting lets you change the number of items shown at 'Your most recent edits' on the dashboard.
  121. ``WAGTAILADMIN_USER_LOGIN_FORM``
  122. --------------------------------
  123. .. code-block:: python
  124. WAGTAILADMIN_USER_LOGIN_FORM = 'users.forms.LoginForm'
  125. Allows the default ``LoginForm`` to be extended with extra fields.
  126. .. _wagtail_gravatar_provider_url:
  127. ``WAGTAIL_GRAVATAR_PROVIDER_URL``
  128. ---------------------------------
  129. .. code-block:: python
  130. WAGTAIL_GRAVATAR_PROVIDER_URL = '//www.gravatar.com/avatar'
  131. If a user has not uploaded a profile picture, Wagtail will look for an avatar linked to their email address on gravatar.com. This setting allows you to specify an alternative provider such as like robohash.org, or can be set to ``None`` to disable the use of remote avatars completely.
  132. .. _wagtail_moderation_enabled:
  133. ``WAGTAIL_MODERATION_ENABLED``
  134. ------------------------------
  135. .. code-block:: python
  136. WAGTAIL_MODERATION_ENABLED = True
  137. Changes whether the Submit for Moderation button is displayed in the action menu.
  138. Comments
  139. ========
  140. .. versionadded:: 2.13
  141. ``WAGTAILADMIN_COMMENTS_ENABLED``
  142. ---------------------------------
  143. .. code-block:: python
  144. # Disable commenting
  145. WAGTAILADMIN_COMMENTS_ENABLED = False
  146. Sets whether commenting is enabled for pages (``True`` by default).
  147. Images
  148. ======
  149. ``WAGTAILIMAGES_IMAGE_MODEL``
  150. -----------------------------
  151. .. code-block:: python
  152. WAGTAILIMAGES_IMAGE_MODEL = 'myapp.MyImage'
  153. This setting lets you provide your own image model for use in Wagtail, which should extend the built-in ``AbstractImage`` class.
  154. ``WAGTAILIMAGES_IMAGE_FORM_BASE``
  155. ---------------------------------
  156. .. code-block:: python
  157. WAGTAILIMAGES_IMAGE_FORM_BASE = 'myapp.forms.MyImageBaseForm'
  158. This setting lets you provide your own image base form for use in Wagtail, which might extend the built-in ``BaseImageForm`` class or replace it entirely.
  159. You can use it to specify or override the widgets to use in the admin form.
  160. ``WAGTAILIMAGES_MAX_UPLOAD_SIZE``
  161. ---------------------------------
  162. .. code-block:: python
  163. WAGTAILIMAGES_MAX_UPLOAD_SIZE = 20 * 1024 * 1024 # i.e. 20MB
  164. This setting lets you override the maximum upload size for images (in bytes). If omitted, Wagtail will fall back to using its 10MB default value.
  165. ``WAGTAILIMAGES_MAX_IMAGE_PIXELS``
  166. ----------------------------------
  167. .. code-block:: python
  168. WAGTAILIMAGES_MAX_IMAGE_PIXELS = 128000000 # i.e. 128 megapixels
  169. This setting lets you override the maximum number of pixels an image can have. If omitted, Wagtail will fall back to using its 128 megapixels default value. The pixel count takes animation frames into account - for example, a 25-frame animation of size 100x100 is considered to have 100 * 100 * 25 = 250000 pixels.
  170. ``WAGTAILIMAGES_FEATURE_DETECTION_ENABLED``
  171. -------------------------------------------
  172. .. code-block:: python
  173. WAGTAILIMAGES_FEATURE_DETECTION_ENABLED = True
  174. This setting enables feature detection once OpenCV is installed, see all details on the :ref:`image_feature_detection` documentation.
  175. ``WAGTAILIMAGES_INDEX_PAGE_SIZE``
  176. ---------------------------------
  177. .. code-block:: python
  178. WAGTAILIMAGES_INDEX_PAGE_SIZE = 20
  179. Specifies the number of images per page shown on the main Images listing in the Wagtail admin.
  180. ``WAGTAILIMAGES_USAGE_PAGE_SIZE``
  181. ---------------------------------
  182. .. code-block:: python
  183. WAGTAILIMAGES_USAGE_PAGE_SIZE = 20
  184. Specifies the number of items per page shown when viewing an image's usage (see :ref:`WAGTAIL_USAGE_COUNT_ENABLED <WAGTAIL_USAGE_COUNT_ENABLED>`).
  185. ``WAGTAILIMAGES_CHOOSER_PAGE_SIZE``
  186. -----------------------------------
  187. .. code-block:: python
  188. WAGTAILIMAGES_CHOOSER_PAGE_SIZE = 12
  189. Specifies the number of images shown per page in the image chooser modal.
  190. Documents
  191. =========
  192. ``WAGTAILDOCS_DOCUMENT_MODEL``
  193. ------------------------------
  194. .. code-block:: python
  195. WAGTAILDOCS_DOCUMENT_MODEL = 'myapp.MyDocument'
  196. This setting lets you provide your own document model for use in Wagtail, which should extend the built-in ``AbstractDocument`` class.
  197. ``WAGTAILDOCS_DOCUMENT_FORM_BASE``
  198. ----------------------------------
  199. .. code-block:: python
  200. WAGTAILDOCS_DOCUMENT_FORM_BASE = 'myapp.forms.MyDocumentBaseForm'
  201. This setting lets you provide your own Document base form for use in Wagtail, which might extend the built-in ``BaseDocumentForm`` class or replace it entirely.
  202. You can use it to specify or override the widgets to use in the admin form.
  203. .. _wagtaildocs_serve_method:
  204. ``WAGTAILDOCS_SERVE_METHOD``
  205. ----------------------------
  206. .. code-block:: python
  207. WAGTAILDOCS_SERVE_METHOD = 'redirect'
  208. Determines how document downloads will be linked to and served. Normally, requests for documents are sent through a Django view, to perform permission checks (see :ref:`image_document_permissions`) and potentially other housekeeping tasks such as hit counting. To fully protect against users bypassing this check, it needs to happen in the same request where the document is served; however, this incurs a performance hit as the document then needs to be served by the Django server. In particular, this cancels out much of the benefit of hosting documents on external storage, such as S3 or a CDN.
  209. For this reason, Wagtail provides a number of serving methods which trade some of the strictness of the permission check for performance:
  210. * ``'direct'`` - links to documents point directly to the URL provided by the underlying storage, bypassing the Django view that provides the permission check. This is most useful when deploying sites as fully static HTML (e.g. using `wagtail-bakery <https://github.com/wagtail/wagtail-bakery>`_ or `Gatsby <https://www.gatsbyjs.org/>`_).
  211. * ``'redirect'`` - links to documents point to a Django view which will check the user's permission; if successful, it will redirect to the URL provided by the underlying storage to allow the document to be downloaded. This is most suitable for remote storage backends such as S3, as it allows the document to be served independently of the Django server. Note that if a user is able to guess the latter URL, they will be able to bypass the permission check; some storage backends may provide configuration options to generate a random or short-lived URL to mitigate this.
  212. * ``'serve_view'`` - links to documents point to a Django view which both checks the user's permission, and serves the document. Serving will be handled by `django-sendfile <https://github.com/johnsensible/django-sendfile>`_, if this is installed and supported by your server configuration, or as a streaming response from Django if not. When using this method, it is recommended that you configure your webserver to *disallow* serving documents directly from their location under ``MEDIA_ROOT``, as this would provide a way to bypass the permission check.
  213. If ``WAGTAILDOCS_SERVE_METHOD`` is unspecified or set to ``None``, the default method is ``'redirect'`` when a remote storage backend is in use (i.e. one that exposes a URL but not a local filesystem path), and ``'serve_view'`` otherwise. Finally, some storage backends may not expose a URL at all; in this case, serving will proceed as for ``'serve_view'``.
  214. .. _wagtaildocs_content_types:
  215. ``WAGTAILDOCS_CONTENT_TYPES``
  216. -----------------------------
  217. .. code-block:: python
  218. WAGTAILDOCS_CONTENT_TYPES = {
  219. 'pdf': 'application/pdf',
  220. 'txt': 'text/plain',
  221. }
  222. Specifies the MIME content type that will be returned for the given file extension, when using the ``serve_view`` method. Content types not listed here will be guessed using the Python ``mimetypes.guess_type`` function, or ``application/octet-stream`` if unsuccessful.
  223. .. _wagtaildocs_inline_content_types:
  224. ``WAGTAILDOCS_INLINE_CONTENT_TYPES``
  225. ------------------------------------
  226. .. code-block:: python
  227. WAGTAILDOCS_INLINE_CONTENT_TYPES = ['application/pdf', 'text/plain']
  228. A list of MIME content types that will be shown inline in the browser (by serving the HTTP header ``Content-Disposition: inline``) rather than served as a download, when using the ``serve_view`` method. Defaults to ``application/pdf``.
  229. .. _wagtaildocs_extensions:
  230. ``WAGTAILDOCS_EXTENSIONS``
  231. --------------------------
  232. .. code-block:: python
  233. WAGTAILDOCS_EXTENSIONS = ['pdf', 'docx']
  234. A list of allowed document extensions that will be validated during document uploading.
  235. If this isn't supplied all document extensions are allowed.
  236. Warning: this doesn't always ensure that the uploaded file is valid as files can
  237. be renamed to have an extension no matter what data they contain.
  238. Password Management
  239. ===================
  240. ``WAGTAIL_PASSWORD_MANAGEMENT_ENABLED``
  241. ---------------------------------------
  242. .. code-block:: python
  243. WAGTAIL_PASSWORD_MANAGEMENT_ENABLED = True
  244. This specifies whether users are allowed to change their passwords (enabled by default).
  245. ``WAGTAIL_PASSWORD_RESET_ENABLED``
  246. ----------------------------------
  247. .. code-block:: python
  248. WAGTAIL_PASSWORD_RESET_ENABLED = True
  249. This specifies whether users are allowed to reset their passwords. Defaults to the same as ``WAGTAIL_PASSWORD_MANAGEMENT_ENABLED``. Password reset emails will be sent from the address specified in Django's ``DEFAULT_FROM_EMAIL`` setting.
  250. ``WAGTAILUSERS_PASSWORD_ENABLED``
  251. ---------------------------------
  252. .. code-block:: python
  253. WAGTAILUSERS_PASSWORD_ENABLED = True
  254. This specifies whether password fields are shown when creating or editing users through Settings -> Users (enabled by default). Set this to False (along with ``WAGTAIL_PASSWORD_MANAGEMENT_ENABLED`` and ``WAGTAIL_PASSWORD_RESET_ENABLED``) if your users are authenticated through an external system such as LDAP.
  255. ``WAGTAILUSERS_PASSWORD_REQUIRED``
  256. ----------------------------------
  257. .. code-block:: python
  258. WAGTAILUSERS_PASSWORD_REQUIRED = True
  259. This specifies whether password is a required field when creating a new user. True by default; ignored if ``WAGTAILUSERS_PASSWORD_ENABLED`` is false. If this is set to False, and the password field is left blank when creating a user, then that user will have no usable password; in order to log in, they will have to reset their password (if ``WAGTAIL_PASSWORD_RESET_ENABLED`` is True) or use an alternative authentication system such as LDAP (if one is set up).
  260. ``WAGTAIL_EMAIL_MANAGEMENT_ENABLED``
  261. ------------------------------------
  262. .. code-block:: python
  263. WAGTAIL_EMAIL_MANAGEMENT_ENABLED = True
  264. This specifies whether users are allowed to change their email (enabled by default).
  265. .. _email_notifications:
  266. Email Notifications
  267. ===================
  268. ``WAGTAILADMIN_NOTIFICATION_FROM_EMAIL``
  269. ----------------------------------------
  270. .. code-block:: python
  271. WAGTAILADMIN_NOTIFICATION_FROM_EMAIL = 'wagtail@myhost.io'
  272. Wagtail sends email notifications when content is submitted for moderation, and when the content is accepted or rejected. This setting lets you pick which email address these automatic notifications will come from. If omitted, Wagtail will fall back to using Django's ``DEFAULT_FROM_EMAIL`` setting if set, or ``webmaster@localhost`` if not.
  273. ``WAGTAILADMIN_NOTIFICATION_USE_HTML``
  274. --------------------------------------
  275. .. code-block:: python
  276. WAGTAILADMIN_NOTIFICATION_USE_HTML = True
  277. Notification emails are sent in `text/plain` by default, change this to use HTML formatting.
  278. ``WAGTAILADMIN_NOTIFICATION_INCLUDE_SUPERUSERS``
  279. ------------------------------------------------
  280. .. code-block:: python
  281. WAGTAILADMIN_NOTIFICATION_INCLUDE_SUPERUSERS = False
  282. Notification emails are sent to moderators and superusers by default. You can change this to exclude superusers and only notify moderators.
  283. .. _update_notifications:
  284. Wagtail update notifications
  285. ============================
  286. ``WAGTAIL_ENABLE_UPDATE_CHECK``
  287. -------------------------------
  288. .. code-block:: python
  289. WAGTAIL_ENABLE_UPDATE_CHECK = True
  290. For admins only, Wagtail performs a check on the dashboard to see if newer releases are available. This also provides the Wagtail team with the hostname of your Wagtail site. If you'd rather not receive update notifications, or if you'd like your site to remain unknown, you can disable it with this setting.
  291. Private pages / documents
  292. =========================
  293. ``PASSWORD_REQUIRED_TEMPLATE``
  294. ------------------------------
  295. .. code-block:: python
  296. PASSWORD_REQUIRED_TEMPLATE = 'myapp/password_required.html'
  297. This is the path to the Django template which will be used to display the "password required" form when a user accesses a private page. For more details, see the :ref:`private_pages` documentation.
  298. ``DOCUMENT_PASSWORD_REQUIRED_TEMPLATE``
  299. ---------------------------------------
  300. .. code-block:: python
  301. DOCUMENT_PASSWORD_REQUIRED_TEMPLATE = 'myapp/document_password_required.html'
  302. As above, but for password restrictions on documents. For more details, see the :ref:`private_pages` documentation.
  303. Login page
  304. ==========
  305. ``WAGTAIL_FRONTEND_LOGIN_TEMPLATE``
  306. -----------------------------------
  307. The basic login page can be customised with a custom template.
  308. .. code-block:: python
  309. WAGTAIL_FRONTEND_LOGIN_TEMPLATE = 'myapp/login.html'
  310. ``WAGTAIL_FRONTEND_LOGIN_URL``
  311. ------------------------------
  312. Or the login page can be a redirect to an external or internal URL.
  313. .. code-block:: python
  314. WAGTAIL_FRONTEND_LOGIN_URL = '/accounts/login/'
  315. For more details, see the :ref:`login_page` documentation.
  316. Case-Insensitive Tags
  317. =====================
  318. ``TAGGIT_CASE_INSENSITIVE``
  319. ---------------------------
  320. .. code-block:: python
  321. TAGGIT_CASE_INSENSITIVE = True
  322. Tags are case-sensitive by default ('music' and 'Music' are treated as distinct tags). In many cases the reverse behaviour is preferable.
  323. Multi-word tags
  324. ===============
  325. ``TAG_SPACES_ALLOWED``
  326. ----------------------
  327. .. code-block:: python
  328. TAG_SPACES_ALLOWED = False
  329. Tags can only consist of a single word, no spaces allowed. The default setting is ``True`` (spaces in tags are allowed).
  330. Tag limit
  331. =========
  332. ``TAG_LIMIT``
  333. -------------
  334. .. code-block:: python
  335. TAG_LIMIT = 5
  336. Limit the number of tags that can be added to (django-taggit) Tag model. Default setting is ``None``, meaning no limit on tags.
  337. Unicode Page Slugs
  338. ==================
  339. ``WAGTAIL_ALLOW_UNICODE_SLUGS``
  340. -------------------------------
  341. .. code-block:: python
  342. WAGTAIL_ALLOW_UNICODE_SLUGS = True
  343. By default, page slugs can contain any alphanumeric characters, including non-Latin alphabets. Set this to False to limit slugs to ASCII characters.
  344. .. _WAGTAIL_AUTO_UPDATE_PREVIEW:
  345. Auto update preview
  346. ===================
  347. ``WAGTAIL_AUTO_UPDATE_PREVIEW``
  348. -------------------------------
  349. .. code-block:: python
  350. WAGTAIL_AUTO_UPDATE_PREVIEW = False
  351. When enabled, data from an edited page is automatically sent to the server
  352. on each change, even without saving. That way, users don’t have to click on
  353. “Preview” to update the content of the preview page. However, the preview page
  354. tab is not refreshed automatically, users have to do it manually.
  355. This behaviour is disabled by default.
  356. Custom User Edit Forms
  357. ======================
  358. See :doc:`/advanced_topics/customisation/custom_user_models`.
  359. ``WAGTAIL_USER_EDIT_FORM``
  360. --------------------------
  361. .. code-block:: python
  362. WAGTAIL_USER_EDIT_FORM = 'users.forms.CustomUserEditForm'
  363. Allows the default ``UserEditForm`` class to be overridden with a custom form when
  364. a custom user model is being used and extra fields are required in the user edit form.
  365. ``WAGTAIL_USER_CREATION_FORM``
  366. ------------------------------
  367. .. code-block:: python
  368. WAGTAIL_USER_CREATION_FORM = 'users.forms.CustomUserCreationForm'
  369. Allows the default ``UserCreationForm`` class to be overridden with a custom form when
  370. a custom user model is being used and extra fields are required in the user creation form.
  371. ``WAGTAIL_USER_CUSTOM_FIELDS``
  372. ------------------------------
  373. .. code-block:: python
  374. WAGTAIL_USER_CUSTOM_FIELDS = ['country']
  375. A list of the extra custom fields to be appended to the default list.
  376. .. _WAGTAIL_USAGE_COUNT_ENABLED:
  377. Usage for images, documents and snippets
  378. ========================================
  379. ``WAGTAIL_USAGE_COUNT_ENABLED``
  380. --------------------------------
  381. .. code-block:: python
  382. WAGTAIL_USAGE_COUNT_ENABLED = True
  383. When enabled Wagtail shows where a particular image, document or snippet is being used on your site.
  384. This is disabled by default because it generates a query which may run slowly on sites with large numbers of pages.
  385. A link will appear on the edit page (in the rightmost column) showing you how many times the item is used.
  386. Clicking this link takes you to the "Usage" page, which shows you where the snippet, document or image is used.
  387. The link is also shown on the delete page, above the "Delete" button.
  388. .. note::
  389. The usage count only applies to direct (database) references. Using documents, images and snippets within StreamFields or rich text fields will not be taken into account.
  390. Date and DateTime inputs
  391. ========================
  392. ``WAGTAIL_DATE_FORMAT``, ``WAGTAIL_DATETIME_FORMAT``, ``WAGTAIL_TIME_FORMAT``
  393. -----------------------------------------------------------------------------
  394. .. code-block:: python
  395. WAGTAIL_DATE_FORMAT = '%d.%m.%Y.'
  396. WAGTAIL_DATETIME_FORMAT = '%d.%m.%Y. %H:%M'
  397. WAGTAIL_TIME_FORMAT = '%H:%M'
  398. Specifies the date, time and datetime format to be used in input fields in the Wagtail admin. The format is specified in `Python datetime module syntax <https://docs.python.org/3/library/datetime.html#strftime-strptime-behavior>`_, and must be one of the recognised formats listed in the ``DATE_INPUT_FORMATS``, ``TIME_INPUT_FORMATS``, or ``DATETIME_INPUT_FORMATS`` setting respectively (see `DATE_INPUT_FORMATS <https://docs.djangoproject.com/en/stable/ref/settings/#std:setting-DATE_INPUT_FORMATS>`_).
  399. .. _WAGTAIL_USER_TIME_ZONES:
  400. Time zones
  401. ==========
  402. Logged-in users can choose their current time zone for the admin interface in the account settings. If is no time zone selected by the user, then ``TIME_ZONE`` will be used.
  403. (Note that time zones are only applied to datetime fields, not to plain time or date fields. This is a Django design decision.)
  404. ``WAGTAIL_USER_TIME_ZONES``
  405. ---------------------------
  406. The list of time zones is by default the common_timezones list from pytz.
  407. It is possible to override this list via the ``WAGTAIL_USER_TIME_ZONES`` setting.
  408. If there is zero or one time zone permitted, the account settings form will be hidden.
  409. .. code-block:: python
  410. WAGTAIL_USER_TIME_ZONES = ['America/Chicago', 'Australia/Sydney', 'Europe/Rome']
  411. .. _WAGTAILADMIN_PERMITTED_LANGUAGES:
  412. Admin languages
  413. ===============
  414. Users can choose between several languages for the admin interface
  415. in the account settings. The list of languages is by default all the available
  416. languages in Wagtail with at least 90% coverage. To change it, set ``WAGTAILADMIN_PERMITTED_LANGUAGES``:
  417. ``WAGTAILADMIN_PERMITTED_LANGUAGES``
  418. ------------------------------------
  419. .. code-block:: python
  420. WAGTAILADMIN_PERMITTED_LANGUAGES = [('en', 'English'),
  421. ('pt', 'Portuguese')]
  422. Since the syntax is the same as Django ``LANGUAGES``, you can do this so users
  423. can only choose between front office languages:
  424. .. code-block:: python
  425. LANGUAGES = WAGTAILADMIN_PERMITTED_LANGUAGES = [('en', 'English'),
  426. ('pt', 'Portuguese')]
  427. Static files
  428. ============
  429. ``WAGTAILADMIN_STATIC_FILE_VERSION_STRINGS``
  430. --------------------------------------------
  431. .. code-block:: python
  432. WAGTAILADMIN_STATIC_FILE_VERSION_STRINGS = False
  433. Static file URLs within the Wagtail admin are given a version-specific query string of the form ``?v=1a2b3c4d``, to prevent outdated cached copies of JavaScript and CSS files from persisting after a Wagtail upgrade. To disable these, set ``WAGTAILADMIN_STATIC_FILE_VERSION_STRINGS`` to ``False``.
  434. API Settings
  435. ============
  436. For full documentation on API configuration, including these settings, see :ref:`api_v2_configuration` documentation.
  437. ``WAGTAILAPI_BASE_URL``
  438. -----------------------
  439. .. code-block:: python
  440. WAGTAILAPI_BASE_URL = 'http://api.example.com/'
  441. Required when using frontend cache invalidation, used to generate absolute URLs to document files and invalidating the cache.
  442. ``WAGTAILAPI_LIMIT_MAX``
  443. ------------------------
  444. .. code-block:: python
  445. WAGTAILAPI_LIMIT_MAX = 500
  446. Default is 20, used to change the maximum number of results a user can request at a time, set to ``None`` for no limit.
  447. ``WAGTAILAPI_SEARCH_ENABLED``
  448. -----------------------------
  449. .. code-block:: python
  450. WAGTAILAPI_SEARCH_ENABLED = False
  451. Default is true, setting this to false will disable full text search on all endpoints.
  452. ``WAGTAILAPI_USE_FRONTENDCACHE``
  453. --------------------------------
  454. .. code-block:: python
  455. WAGTAILAPI_USE_FRONTENDCACHE = True
  456. Requires ``wagtailfrontendcache`` app to be installed, indicates the API should use the frontend cache.
  457. Frontend cache
  458. ==============
  459. For full documentation on frontend cache invalidation, including these settings, see :ref:`frontend_cache_purging`.
  460. ``WAGTAILFRONTENDCACHE``
  461. ------------------------
  462. .. code-block:: python
  463. WAGTAILFRONTENDCACHE = {
  464. 'varnish': {
  465. 'BACKEND': 'wagtail.contrib.frontend_cache.backends.HTTPBackend',
  466. 'LOCATION': 'http://localhost:8000',
  467. },
  468. }
  469. See documentation linked above for full options available.
  470. .. note::
  471. ``WAGTAILFRONTENDCACHE_LOCATION`` is no longer the preferred way to set the cache location, instead set the ``LOCATION`` within the ``WAGTAILFRONTENDCACHE`` item.
  472. ``WAGTAILFRONTENDCACHE_LANGUAGES``
  473. ----------------------------------
  474. .. code-block:: python
  475. WAGTAILFRONTENDCACHE_LANGUAGES = [l[0] for l in settings.LANGUAGES]
  476. Default is an empty list, must be a list of languages to also purge the urls for each language of a purging url. This setting needs ``settings.USE_I18N`` to be ``True`` to work.
  477. .. _WAGTAILADMIN_RICH_TEXT_EDITORS:
  478. Rich text
  479. =========
  480. ``WAGTAILADMIN_RICH_TEXT_EDITORS``
  481. ----------------------------------
  482. .. code-block:: python
  483. WAGTAILADMIN_RICH_TEXT_EDITORS = {
  484. 'default': {
  485. 'WIDGET': 'wagtail.admin.rich_text.DraftailRichTextArea',
  486. 'OPTIONS': {
  487. 'features': ['h2', 'bold', 'italic', 'link', 'document-link']
  488. }
  489. },
  490. 'legacy': {
  491. 'WIDGET': 'wagtail.admin.rich_text.HalloRichTextArea',
  492. }
  493. }
  494. Customise the behaviour of rich text fields. By default, ``RichTextField`` and ``RichTextBlock`` use the configuration given under the ``'default'`` key, but this can be overridden on a per-field basis through the ``editor`` keyword argument, e.g. ``body = RichTextField(editor='legacy')``. Within each configuration block, the following fields are recognised:
  495. * ``WIDGET``: The rich text widget implementation to use. Wagtail provides two implementations: ``wagtail.admin.rich_text.DraftailRichTextArea`` (a modern extensible editor which enforces well-structured markup) and ``wagtail.admin.rich_text.HalloRichTextArea`` (deprecated; works directly at the HTML level). Other widgets may be provided by third-party packages.
  496. * ``OPTIONS``: Configuration options to pass to the widget. Recognised options are widget-specific, but both ``DraftailRichTextArea`` and ``HalloRichTextArea`` accept a ``features`` list indicating the active rich text features (see :ref:`rich_text_features`).
  497. If a ``'default'`` editor is not specified, rich text fields that do not specify an ``editor`` argument will use the Draftail editor with the default feature set enabled.
  498. .. _WAGTAILADMIN_EXTERNAL_LINK_CONVERSION:
  499. ``WAGTAILADMIN_EXTERNAL_LINK_CONVERSION``
  500. -----------------------------------------
  501. .. code-block:: python
  502. WAGTAILADMIN_EXTERNAL_LINK_CONVERSION = 'exact'
  503. Customise Wagtail's behaviour when an internal page url is entered in the external link chooser. Possible values for this setting are
  504. ``'all'``, ``'exact'``, ``'confirm``, or ``''``. The default, ``'all'``, means that Wagtail will automatically convert submitted urls that exactly match
  505. page urls to the corresponding internal links. If the url is an inexact match - for example, the submitted url has query parameters - then
  506. Wagtail will confirm the conversion with the user. ``'exact'`` means that any inexact matches will be left as external urls, and the confirmation
  507. step will be skipped. ``'confirm'`` means that every link conversion will be confirmed with the user, even if the match is exact. ``''`` means
  508. that Wagtail will not attempt to convert any urls entered to internal page links.
  509. .. _WAGTAILADMIN_GLOBAL_PAGE_EDIT_LOCK:
  510. Page locking
  511. ============
  512. ``WAGTAILADMIN_GLOBAL_PAGE_EDIT_LOCK``
  513. --------------------------------------
  514. ``WAGTAILADMIN_GLOBAL_PAGE_EDIT_LOCK`` can be set to ``True`` to prevent users
  515. from editing pages that they have locked.
  516. Redirects
  517. =========
  518. ``WAGTAIL_REDIRECTS_FILE_STORAGE``
  519. ----------------------------------
  520. .. code-block:: python
  521. WAGTAIL_REDIRECTS_FILE_STORAGE = 'tmp_file'
  522. By default the redirect importer keeps track of the uploaded file as a temp file, but on certain environments (load balanced/cloud environments), you cannot keep a shared file between environments. For those cases you can use the built-in cache to store the file instead.
  523. .. code-block:: python
  524. WAGTAIL_REDIRECTS_FILE_STORAGE = 'cache'
  525. Form builder
  526. ============
  527. ``WAGTAILFORMS_HELP_TEXT_ALLOW_HTML``
  528. -------------------------------------
  529. .. code-block:: python
  530. WAGTAILFORMS_HELP_TEXT_ALLOW_HTML = True
  531. When true, HTML tags in form field help text will be rendered unescaped (default: False).
  532. .. WARNING::
  533. Enabling this option will allow editors to insert arbitrary HTML into the page, such as scripts that could allow the editor to acquire administrator privileges when another administrator views the page. Do not enable this setting unless your editors are fully trusted.
  534. .. _workflow_settings:
  535. Workflow
  536. ========
  537. ``WAGTAIL_WORKFLOW_ENABLED``
  538. ----------------------------
  539. .. code-block:: python
  540. WAGTAIL_WORKFLOW_ENABLED = False
  541. Specifies whether moderation workflows are enabled (default: True). When disabled, editors will no longer be given the option to submit pages to a workflow, and the settings areas for admins to configure workflows and tasks will be unavailable.
  542. ``WAGTAIL_WORKFLOW_REQUIRE_REAPPROVAL_ON_EDIT``
  543. -----------------------------------------------
  544. .. code-block:: python
  545. WAGTAIL_WORKFLOW_REQUIRE_REAPPROVAL_ON_EDIT = True
  546. Moderation workflows can be used in two modes. The first is to require that all tasks must approve a specific page revision for the workflow to complete. As a result,
  547. if edits are made to a page while it is in moderation, any approved tasks will need to be re-approved for the new revision before the workflow finishes.
  548. This is the default, ``WAGTAIL_WORKFLOW_REQUIRE_REAPPROVAL_ON_EDIT = True`` . The second mode does not require reapproval: if edits are made when
  549. tasks have already been approved, those tasks do not need to be reapproved. This is more suited to a hierarchical workflow system. To use workflows in this mode,
  550. set ``WAGTAIL_WORKFLOW_REQUIRE_REAPPROVAL_ON_EDIT = False``.
  551. ``WAGTAIL_FINISH_WORKFLOW_ACTION``
  552. ----------------------------------
  553. .. code-block:: python
  554. WAGTAIL_FINISH_WORKFLOW_ACTION = 'wagtail.core.workflows.publish_workflow_state'
  555. This sets the function to be called when a workflow completes successfully - by default, ``wagtail.core.workflows.publish_workflow_state``,
  556. which publishes the page. The function must accept a ``WorkflowState`` object as its only positional argument.
  557. ``WAGTAIL_WORKFLOW_CANCEL_ON_PUBLISH``
  558. --------------------------------------
  559. .. code-block:: python
  560. WAGTAIL_WORKFLOW_CANCEL_ON_PUBLISH = True
  561. This determines whether publishing a page with an ongoing workflow will cancel the workflow (if true) or leave the workflow unaffected (false).
  562. Disabling this could be useful if your site has long, multi-step workflows, and you want to be able to publish urgent page updates while the
  563. workflow continues to provide less urgent feedback.