mirror of
https://github.com/django-q2/django-q2.git
synced 2026-10-02 12:48:11 +08:00
docs: updated management command example
This commit is contained in:
+14
-1
@@ -57,7 +57,20 @@ The scheduler will then skip execution of scheduled events in the past. Instead
|
||||
Management Commands
|
||||
-------------------
|
||||
|
||||
If you want to schedule regular Django management commands, you can use the :mod:`django.core.management` module to make a wrapper function which you can schedule in Django Q::
|
||||
If you want to schedule regular Django management commands, you can use the :mod:`django.core.management` module to call them directly:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from django_q.tasks import schedule
|
||||
|
||||
# run `manage.py clearsession` every hour
|
||||
schedule('django.core.management.call_command',
|
||||
'clearsessions',
|
||||
schedule_type='H')
|
||||
|
||||
Or you can make a wrapper function which you can then schedule in Django Q:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
# tasks.py
|
||||
from django.core import management
|
||||
|
||||
Reference in New Issue
Block a user