management_commands.rst 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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. .. _update_index:
  28. update_index
  29. ------------
  30. .. code-block:: console
  31. $ ./manage.py update_index [--backend <backend name>]
  32. This command rebuilds the search index from scratch. It is not required when using the database search backend (``wagtail.search.backends.db``).
  33. It is recommended to run this command once a week and at the following times:
  34. - whenever any pages have been created through a script (after an import, for example)
  35. - whenever any changes have been made to models or search configuration
  36. The search may not return any results while this command is running, so avoid running it at peak times.
  37. Specifying which backend to update
  38. ``````````````````````````````````
  39. By default, ``update_index`` will rebuild all the search indexes listed in ``WAGTAILSEARCH_BACKENDS``.
  40. If you have multiple backends and would only like to update one of them, you can use the ``--backend`` option.
  41. For example, to update just the default backend:
  42. .. code-block:: console
  43. $ python manage.py update_index --backend default
  44. The ``--chunk_size`` option can be used to set the size of chunks that are indexed at a time. This defaults to
  45. 1000 but may need to be reduced for larger document sizes.
  46. Indexing the schema only
  47. ````````````````````````
  48. You can prevent the ``update_index`` command from indexing any data by using the ``--schema-only`` option:
  49. .. code-block:: console
  50. $ python manage.py update_index --schema-only
  51. .. _wagtail_update_index:
  52. wagtail_update_index
  53. --------------------
  54. 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.
  55. .. _search_garbage_collect:
  56. search_garbage_collect
  57. ----------------------
  58. .. code-block:: console
  59. $ ./manage.py search_garbage_collect
  60. 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).