如何从Django中的新数据库重新开始? [英] How to start afresh with a new database in Django?

查看:41
本文介绍了如何从Django中的新数据库重新开始?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我删除了数据库.我想重新开始一个新的数据库.我怎样才能做到这一点 ?我尝试制作一个新的数据源,但是在应用迁移/或迁移时找不到一个表,这给了我一个错误?这是正确的,因为它是一个空数据库.

I deleted my database. I want to start afresh with a new database. How can I do that ? I tried making a new datasource but it gives me an error while applying migrations/or migrating that it couldn't find the tables? Which is true because its an empty database.

一种类似的情况是,当有人拉出我的代码的一个版本时.他不会迁移或数据库(未跟踪).他将如何运行该应用程序?

A similar scenario would be when some one pulls a version of my code. He wouldn't have migrations or the database (untracked). How would he run the application?

推荐答案

删除所有名为"migrations"的文件夹.然后转到终端并运行 ./manage.py makemigrations ./manage.py migration --run-syncdb .

Delete all the folders named 'migrations'. And go to terminal and run ./manage.py makemigrations, ./manage.py migrate --run-syncdb.

这篇关于如何从Django中的新数据库重新开始?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆