Django python manage.py 迁移

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20238317/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-18 19:57:25  来源:igfitidea点击:

Django python manage.py migrate

pythondjangowindows

提问by user3041020

I have installed on Win7 portable Python 2.7.5.1 and Django 1.6.

我已经安装在 Win7 便携式 Python 2.7.5.1 和 Django 1.6 上。

I followed the first polls tutorial instructions and got an error in the migrate stage, python manage.py migrate:

我按照第一个民意调查教程说明进行操作,但在迁移阶段出现错误python manage.py migrate

C:\Natan\Dev\Portable Python 2.7.5.1\App\Scripts\mysite>..\..\python.exe manage.py migrate
Unknown command: 'migrate'
Type 'manage.py help' for usage.

Any idea?

任何的想法?

回答by Daniel Roseman

If you've installed 1.6, you should use the 1.6 tutorial, not the one for the development version.

如果您安装了 1.6,则应使用1.6 教程,而不是开发版教程

回答by Mounir

You must install Southto add migrate command.

您必须安装South才能添加 migrate 命令。

pip install south

pip install south

回答by OBu

Migrate will be a native command in 1.7 (which is the version you read the tutorial pages from).

Migrate 将是 1.7 中的本机命令(这是您阅读教程页面的版本)。

For older versions, you'll have to install the third party app"South".

对于旧版本,您必须安装第三方应用程序“South”。

回答by R Claven

All-

全部-

This is likely caused largely by following the 1.7 (DEV version!) tutorial when we all get the last stable version (1.6!) installed by pip.

这可能主要是由于遵循 1.7(DEV 版本!)教程,当我们都获得了 pip 安装的最后一个稳定版本(1.6!)。

It would not appear migrate is even a part of 1.7 in general! Will:

一般情况下,迁移甚至不会出现在 1.7 中!将要:

python manage.py syncdb

python manage.py syncdb

Solve your problems?

解决您的问题?

So pls either follow the tutorial for the last stable version of django: https://docs.djangoproject.com/en/1.6/intro/tutorial01/

所以请遵循 django 最新稳定版本的教程:https: //docs.djangoproject.com/en/1.6/intro/tutorial01/

Or follow the instructions to install the dev version of Django.

或者按照说明安装 Django 的开发版本。

Dear Django team, You guys are awesome. The JS developer is very impressed. But PLEASE resolve the discrepancy above. Maybe default to 1.6 docs and put in red letters: Dev version here?

亲爱的 Django 团队,你们太棒了。JS 开发人员印象非常深刻。但请解决上述差异。也许默认为 1.6 文档并用红色字母表示:这里是开发版本?

Thank you.

谢谢你。

回答by Mike Bolívar

First Step, Install South:

第一步,安装南:

pip install south

pip 安装南

Second Step, Add South to INSTALLED APPS in settings

第二步,在设置中添加South to INSTALLED APPS

INSTALLED_APPS = ( ..., 'south' )

INSTALLED_APPS = ( ..., '南' )

回答by Vineet Jain

If you are using Django older versions before 1.7 then you should sync database by
python manage.py syncdb
while in new versions after 1.7 syncdb is replaced by migration. So for syncdb in new django version is replaced by :-
python manage.py makemigrations python manage.py migrate
for more type:-
python manage.py help

如果您使用的是 1.7 之前的 Django 旧版本,那么您应该
python manage.py syncdb
在 1.7 syncdb 被迁移替换后的新版本中同步数据库。因此,对于新 django 版本中的 syncdb 被替换为:-
python manage.py makemigrations python manage.py migrate
对于更多类型:-
python manage.py help