编辑2
如果有人可以发布模式应该是什么,我会非常高兴!我只需要知道表名和列名!
我正在学习本教程:
http://www.caktusgroup.com/blog/2014/06/23/scheduling-tasks-celery/
我已经成功安装了django-celery。
#settings.py
import djcelery
djcelery.setup_loader()
BROKER_URL = 'django://'
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'charts',
'social.apps.django_app.default',
'django.contrib.staticfiles',
'djcelery',
'kombu.transport.django',
)
当我运行python manage.py syncdb
时:
Creating tables ...
Creating table django_admin_log
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_groups
Creating table auth_user_user_permissions
Creating table auth_user
Creating table django_content_type
Creating table django_session
Creating table social_auth_usersocialauth
Creating table social_auth_nonce
Creating table social_auth_association
Creating table social_auth_code
Creating table celery_taskmeta
Creating table celery_tasksetmeta
Creating table djcelery_intervalschedule
Creating table djcelery_crontabschedule
Creating table djcelery_periodictasks
Creating table djcelery_periodictask
Creating table djcelery_workerstate
Creating table djcelery_taskstate
然而,当我运行python manage.py celery worker --loglevel=info
时,我最终得到:
OperationalError: no such table: djkombu_queue
我已尝试卸载并重新安装所有内容,但无法弄清楚为何没有创建此表。如何创建这个表?
修改 在查看另一个问题之后我问了这个问题,因为将设置更改为:
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'charts',
'social.apps.django_app.default',
'djcelery',
'kombu.transport.django',
'djcelery.transport',
)
或
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'charts',
'social.apps.django_app.default',
'djcelery',
'djcelery.transport',
)
仍然导致:
Creating tables ...
Creating table django_admin_log
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_groups
Creating table auth_user_user_permissions
Creating table auth_user
Creating table django_content_type
Creating table django_session
Creating table social_auth_usersocialauth
Creating table social_auth_nonce
Creating table social_auth_association
Creating table social_auth_code
Creating table celery_taskmeta
Creating table celery_tasksetmeta
Creating table djcelery_intervalschedule
Creating table djcelery_crontabschedule
Creating table djcelery_periodictasks
Creating table djcelery_periodictask
Creating table djcelery_workerstate
Creating table djcelery_taskstate
然而djkombu_queue
仍然缺失......
答案 0 :(得分:6)
自从6天以来一直坚持使用同样的东西......以下最终解决了它: -
pip install django-kombu
然后将djkombu
添加到INSTALLED APPS
: -
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'django.contrib.admindocs',
'djcelery',
'djkombu',
'app1',
'app2',
'app3',
'app4',
)
然后一个新鲜的syndb: -
python manage.py syncdb
您可以使用以下方法检查架构: -
python manage.py sqlall djkombu
答案 1 :(得分:1)
根据current Celery documentation,有必要在已安装的应用中加入kombu.transport.django
:
INSTALLED_APPS += ["kombu.transport.django"]
答案 2 :(得分:0)
试试这个:
在installed_apps
中添加djcelery.transportINSTALLED_APPS = ('djcelery.transport', )
答案 3 :(得分:0)
在尝试生成表格时,各种版本的Django,Django-Celery和Kombu之间出现了问题。
我设法找到Django 1.6.5,django-celery 3.1.16和Kombu 3.0.21 WORKS。