Answer the question
In order to leave comments, you need to log in
How to run periodic_task?
I am trying to run the code once per minute
from celery.schedules import crontab
from celery.decorators import periodic_task
# from celery.task import periodic_task
@periodic_task(run_every=crontab(minute='*/1'))
def my_task():
print('Test')
File "c:\users\admin\appdata\local\programs\python\python37\lib\importlib_init_.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1006, in _gcd_import File "", line 983, in _find_and_load File "", line 967, in _find_and_load_unlocked File "", line 677, in _load_unlocked
File "", line 728, in exec_module File "", line 219, in _call_with_frames_removed File "D:\Work\Project\git\shop\apps\offers\tasks.py", line 32, in @periodic_task(run_every=crontab(minute='*/1')) File "c:\users\admin \appdata\local\programs\python\python37\lib\site-packages\celery\local.py", line 403, in _compat_periodic_task_decorator from celery.task import periodic_task ModuleNotFoundError: No module named 'celery.task'
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question