1
我试图关注django的芹菜doc。这里是我的项目结构:芹菜定期任务不工作
├── hiren
│ ├── celery_app.py
│ ├── __init__.py
│ ├── settings.py
│ ├── urls.py
│ └── wsgi.py
├── manage.py
├── reminder
│ ├── admin.py
│ ├── __init__.py
│ ├── migrations
│ ├── models.py
│ ├── serializers.py
│ |── task.py
│ |── tests.py
│ |── views.py
这里是我的settings.py文件:
BROKER_URL = 'redis://localhost:6379/4'
CELERYBEAT_SCHEDULE = {
'run-every-5-seconds': {
'task': 'reminder.task.run',
'schedule': timedelta(seconds=5),
'args': (16, 16)
},
}
和提醒/ task.py文件:
def run():
print('hello')
当我运行celery -A hiren beat -l debug
命令我没在终端看不到“你好”的文字。我错过了什么?
你看过:http://celery.readthedocs.org/en/latest/django/first-steps-with-django.html#using-the-shared-task-decorator? – Brandon