如何重置db在Django?我得到命令“重置”未找到错误 [英] How to reset db in Django? I get a command 'reset' not found error
问题描述
在这个Django之后的示例tutotrial在这里: http://lightbird.net/dbe/todo_list.html p>
教程说:
这会改变我们的表布局,请求Django重置
并重新创建表格:
manage.py reset todo; manage.py syncdb
但是,当我运行 manage.py reset todo
得到错误:
$ python manage.py reset todo
- 未知命令:'reset'
这是因为我使用的是sqlite3而不是postgresql?
有人可以告诉我什么命令是重置数据库?
命令: python manage.py sqlclear todo
返回错误:
$ python manage.py sqlclear todo
CommandError:App无法找到标签todo。
您确定您的INSTALLED_APPS设置正确吗?
所以我在settings.py中添加了'todo'到我的INSTALLED_APPS,并运行 python manage.py sqlclear todo
,导致此错误:
$ python manage.py sqlclear todo
- NameError:name'admin'未定义
reset
替换为 flush
,参见: python manage.py help flush
Following this Django by Example tutotrial here: http://lightbird.net/dbe/todo_list.html
The tutorial says:
"This changes our table layout and we’ll have to ask Django to reset and recreate tables:
manage.py reset todo; manage.py syncdb
"
though, when I run manage.py reset todo
, I get the error:
$ python manage.py reset todo
- Unknown command: 'reset'
Is this because I am using sqlite3 and not postgresql?
Can somebody tell me what the command is to reset the database?
The command: python manage.py sqlclear todo
returns the error:
$ python manage.py sqlclear todo
CommandError: App with label todo could not be found.
Are you sure your INSTALLED_APPS setting is correct?
So I added 'todo' to my INSTALLED_APPS in settings.py, and ran python manage.py sqlclear todo
again, resulting in this error:
$ python manage.py sqlclear todo
- NameError: name 'admin' is not defined
reset
has been replaced by flush
with Django 1.5, see:
python manage.py help flush
这篇关于如何重置db在Django?我得到命令“重置”未找到错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!