我心狠手辣
$ 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
时,migrate
和 schemamigration
命令没有出现在列表中.
However, when I run the manage.py help
, the migrate
and schemamigration
commands don't appear listed.
我仔细检查了我的 settings.py
文件是否在 INSTALLED_APPS
下列出了south"(拉取后我没有更改此文件).
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.
非常感谢任何帮助!
成功导入包对于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.
最初可以简化您的问题的建议:
Advices that simplify your problem initially:
path..to..south/management/commands
(未压缩)中..
或 ..
中不应有其他 south
目录.path..to..south/management/commands
(not zipped).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.
主要需求调查示例:
$ python manage.py shell
>>> import os
>>> import south.management.commands.migrate
>>> assert os.path.isfile(south.management.commands.migrate.__file__)
这篇关于南:未知命令“迁移"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!