南:未知命令'迁移' [英] South: Unknown command 'migrate'

查看:157
本文介绍了南:未知命令'迁移'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在无情

$ python manage.py migrate
Unknown command: 'migrate'
Type 'manage.py help' for usage.

我将代码从github拉到一台新电脑上。此代码已经过测试,正在其他计算机上工作。整个代码运行正常,除了事实我无法运行迁移!

I pulled the code from github onto a fresh computer. This code is tested and is working on other computers. The entire code runs fine except for the fact I can't run migrations!

安装我的虚拟环境并运行 pip install -r requirements.txt 。它安装所有东西,包括南。我可以通过运行

Installed my virtual environment and ran pip install -r requirements.txt. It installs everything, including South. I can check by running

$ python manage.py shell
>>> import south
>>> south.__version__
'0.7.3'

但是,当我运行 manage.py help 迁移 schemamigration 命令不会出现列出。

However, when I run the manage.py help, the migrate and schemamigration commands don't appear listed.

我重新检查了我的 settings.py 文件在 INSTALLED_APPS (我拉后不改变这个文件)。

I double checked that my settings.py file has 'south' listed under INSTALLED_APPS (I didn't change this file after pulling).

我试过 pip uninstall south 然后再次运行 pip install -r requirements.txt ,但我仍然收到相同的错误。

I tried pip uninstall south and then running pip install -r requirements.txt again, but I still get the same error.

真的非常感谢任何帮助!

Would really appreciate any help!

推荐答案

成功导入包对于Django管理命令是不够的。 Python可以从压缩的蛋中导入一个包,但Django需要一个正常的未压缩文件。

Successful import of package is not enough for Django management commands. Python can import a package easy from a zipped egg but Django needs a normal uncompressed file.

最初简化问题的建议:


  1. 管理命令必须作为正常目录中的文件 path..to..south / management / commands (不压缩) 。

  2. 尝试手动查找和删除旧的南方安装。
    一个常见的问题是一些软件包的一个版本已经通过easy_install(zipped)安装,或者通过python setup.py install手动安装,但是pip没有卸载它,并且是第二次安装。 >
  3. 仅在python路径中使用绝对目录。不要改变安装程序和运行Django之间的python路径,无论是在环境中还是通过自定义的manage或settings.py,如果可能的话。一些manage.py或settings.py使用与软件包内的使用不同的python路径,例如添加 。或..之前的其他目录。您不应该在中 c>或之间的其他 south 目录。在您的项目中。

  1. Management commands must exist as files in a normal directory path..to..south/management/commands (not zipped).
  2. Try to find and remove old installations of south manually. A frequent problem was that one version of some package has been installed by easy_install (zipped) or manually by "python setup.py install" but pip didn't uninstall it and installed it for the second time.
  3. Use only absolute directories in python path. Do not change the python path between installer and running Django either in environment or by customized manage or settings.py if possible. Some manage.py or settings.py use different python path than the one used by package intallers, e.g. added "." or ".." before other directories. You should not have other south directory in . or .. in your project.

建议1是Django的绝对要求。即使我使用多个版本来测试我的应用程序与多个版本的Python,Django等,另外两个是相同的。

The advice 1 is an absolute requirement of Django. The other two are heplful even if I use multiple versions somehow for testing my applications with multiple versions of Python, Django etc.

主要要求的调查示例: p>

Example of investigation of the main requirement:

$ python manage.py shell
>>> import os
>>> import south.management.commands.migrate
>>> assert os.path.isfile(south.management.commands.migrate.__file__)

这篇关于南:未知命令'迁移'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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