在Django 1.9中应该使用什么代替syncdb? [英] What should I use instead of syncdb in Django 1.9?

查看:109
本文介绍了在Django 1.9中应该使用什么代替syncdb?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

看看这个:

$ pypy ./manage.py syncdb
/usr/lib64/pypy-2.4.0/site-packages/django/core/management/commands/syncdb.py:24: RemovedInDjango19Warning: The syncdb command will be removed in Django 1.9
  warnings.warn("The syncdb command will be removed in Django 1.9", RemovedInDjango19Warning)

(cut)

我跑了快速google搜索,但无法找到答案 - 我应该使用什么而不是 syncdb

I ran a quick google search, but could not find the answer - what should I be using instead of syncdb?

推荐答案

syncdb 因为迁移系统 1 已被弃用。

现在,您可以使用 makemigrations 跟踪您的更改。这将把您的模型更改转换为python代码,使其可部署到另一个数据库。

Now you can track your changes using makemigrations. This transforms your model changes into python code to make them deployable to another databases.

创建迁移后,您必须应用它们: code> migrate 。

After you created the migrations you have to apply them: migrate.

所以不要使用 syncdb makemigrations 然后迁移

1 :imho:django最好的新功能。

这篇关于在Django 1.9中应该使用什么代替syncdb?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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