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