management_commands.rst 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. .. _management_commands:
  2. Management commands
  3. ===================
  4. .. _publish_scheduled_pages:
  5. publish_scheduled_pages
  6. -----------------------
  7. .. code-block:: console
  8. $ ./manage.py publish_scheduled_pages
  9. This command publishes, updates or unpublishes pages that have had these actions scheduled by an editor. We recommend running this command once an hour.
  10. .. _fixtree:
  11. fixtree
  12. -------
  13. .. code-block:: console
  14. $ ./manage.py fixtree
  15. This command scans for errors in your database and attempts to fix any issues it finds.
  16. .. _move_pages:
  17. move_pages
  18. ----------
  19. .. code-block:: console
  20. $ manage.py move_pages from to
  21. This command moves a selection of pages from one section of the tree to another.
  22. Options:
  23. - **from**
  24. This is the **id** of the page to move pages from. All descendants of this page will be moved to the destination. After the operation is complete, this page will have no children.
  25. - **to**
  26. This is the **id** of the page to move pages to.
  27. .. _purge_revisions:
  28. purge_revisions
  29. ---------------
  30. .. code-block:: console
  31. $ manage.py purge_revisions [--days=<number of days>]
  32. This command deletes old page revisions which are not in moderation, live, approved to go live, or the latest
  33. revision for a page. If the ``days`` argument is supplied, only revisions older than the specified number of
  34. days will be deleted.
  35. .. _update_index:
  36. update_index
  37. ------------
  38. .. code-block:: console
  39. $ ./manage.py update_index [--backend <backend name>]
  40. This command rebuilds the search index from scratch.
  41. It is recommended to run this command once a week and at the following times:
  42. - whenever any pages have been created through a script (after an import, for example)
  43. - whenever any changes have been made to models or search configuration
  44. The search may not return any results while this command is running, so avoid running it at peak times.
  45. Specifying which backend to update
  46. ``````````````````````````````````
  47. By default, ``update_index`` will rebuild all the search indexes listed in ``WAGTAILSEARCH_BACKENDS``.
  48. If you have multiple backends and would only like to update one of them, you can use the ``--backend`` option.
  49. For example, to update just the default backend:
  50. .. code-block:: console
  51. $ python manage.py update_index --backend default
  52. The ``--chunk_size`` option can be used to set the size of chunks that are indexed at a time. This defaults to
  53. 1000 but may need to be reduced for larger document sizes.
  54. Indexing the schema only
  55. ````````````````````````
  56. You can prevent the ``update_index`` command from indexing any data by using the ``--schema-only`` option:
  57. .. code-block:: console
  58. $ python manage.py update_index --schema-only
  59. .. _wagtail_update_index:
  60. wagtail_update_index
  61. --------------------
  62. An alias for the ``update_index`` command that can be used when another installed package (such as `Haystack <https://haystacksearch.org/>`_) provides a command named ``update_index``. In this case, the other package's entry in ``INSTALLED_APPS`` should appear above ``wagtail.search`` so that its ``update_index`` command takes precedence over Wagtail's.
  63. .. _search_garbage_collect:
  64. search_garbage_collect
  65. ----------------------
  66. .. code-block:: console
  67. $ ./manage.py search_garbage_collect
  68. Wagtail keeps a log of search queries that are popular on your website. On high traffic websites, this log may get big and you may want to clean out old search queries. This command cleans out all search query logs that are more than one week old (or a number of days configurable through the :ref:`WAGTAILSEARCH_HITS_MAX_AGE <wagtailsearch_hits_max_age>` setting).