编辑2
如果有人能发布模式应该是什么,我会非常高兴!我只需要知道表名和列名!
我遵循这个教程:
http://www.caktusgroup.com/blog/2014/06/23/scheduling-tasks-celery/
我已经成功地安装了django芹菜。
#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
仍然缺失。。。
从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',
)
然后是一个新的综合征:-
python manage.py syncdb
您可以使用以下工具检查架构:-
python manage.py sqlall djkombu
根据当前的Celery文档,有必要将kombu.transport.django
包含在已安装的应用程序中:
INSTALLED_APPS += ["kombu.transport.django"]
试试这个:
在installed_apps 中添加djcelery.transport
INSTALLED_APPS = ('djcelery.transport', )
在尝试生成表时,Django、Django Celery和Kombu的不同版本之间出现了一些问题。
我设法发现Django 1.6.5、Django芹菜3.1.16和Kombu 3.0.21有效。