management_commands.rst 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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 or unpublishes pages that have had these actions scheduled by an editor. It is recommended to run 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 only required when using Elasticsearch.
  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. Indexing the schema only
  45. ````````````````````````
  46. You can prevent the ``update_index`` command from indexing any data by using the ``--schema-only`` option:
  47. .. code-block:: console
  48. $ python manage.py update_index --schema-only
  49. .. _search_garbage_collect:
  50. search_garbage_collect
  51. ----------------------
  52. .. code-block:: console
  53. $ ./manage.py search_garbage_collect
  54. 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).