根据姜戈-芹菜的documentation,如果我有南方,我应该打电话给
python manage.py migrate djcelery但是,它所做的只是创建一些迁移文件:
Running migrations for djcelery:
- Migrating forwards to 0001_initial
> djcelery:0001_initial
- Loading initial data for djcelery.
No fixtures found.它不会像它应该做的那样创建下面的表。在从INSTALLED_APPS移除south之后我做了syncdb:
Creating table djcelery_intervalschedule
Creating table djcelery_crontabschedule
Creating table djcelery_periodictasks
Creating table djcelery_periodictask
Creating table djcelery_workerstate
Creating table djcelery_taskstate但是,如果存在south,则不会使用创建这些表
python manage.py syncdb奇怪的是,昨天我用syncdb获得了这些表,但我真的不知道我做了什么才能让它工作,也不能重现它。这在Windows 7和Ubuntu 11.10上都会发生
我想知道我是不是做错了。任何意见都将不胜感激!
发布于 2012-03-23 05:03:14
我们也遇到了同样的问题,通过使用带有syncdb的--all标志,我们能够安装使用South创建的所有表
python manage.py syncdb --all发布于 2011-12-12 17:08:10
如果表已经存在,则djcelery似乎会默默地失败:请参阅https://github.com/ask/django-celery/blob/master/djcelery/migrations/0001_initial.py
您可以尝试修补迁移并打印异常消息。这可能会有所帮助。
编辑:也许您可以尝试使用以下内容在0001_initial.py中编辑ignore_exists。(好的,不是很干净,但这可能有助于理解)
def ignore_exists(fun, *args, **kwargs):
try:
fun(*args, **kwargs)
except DatabaseError, exc:
print "##", exc #This is the patch
if "exists" in str(exc):
return False
raise
return True发布于 2014-11-18 19:53:34
只需运行此命令,我最近使用它并创建了所有djcelery表。
python manage.py migratehttps://stackoverflow.com/questions/8470976
复制相似问题