• <i id='B5cGD'><tr id='B5cGD'><dt id='B5cGD'><q id='B5cGD'><span id='B5cGD'><b id='B5cGD'><form id='B5cGD'><ins id='B5cGD'></ins><ul id='B5cGD'></ul><sub id='B5cGD'></sub></form><legend id='B5cGD'></legend><bdo id='B5cGD'><pre id='B5cGD'><center id='B5cGD'></center></pre></bdo></b><th id='B5cGD'></th></span></q></dt></tr></i><div id='B5cGD'><tfoot id='B5cGD'></tfoot><dl id='B5cGD'><fieldset id='B5cGD'></fieldset></dl></div>

    <tfoot id='B5cGD'></tfoot>

      <bdo id='B5cGD'></bdo><ul id='B5cGD'></ul>

  • <legend id='B5cGD'><style id='B5cGD'><dir id='B5cGD'><q id='B5cGD'></q></dir></style></legend>

    1. <small id='B5cGD'></small><noframes id='B5cGD'>

      1. 南:未知命令“迁移"

        时间:2023-10-20
            <i id='j4Npb'><tr id='j4Npb'><dt id='j4Npb'><q id='j4Npb'><span id='j4Npb'><b id='j4Npb'><form id='j4Npb'><ins id='j4Npb'></ins><ul id='j4Npb'></ul><sub id='j4Npb'></sub></form><legend id='j4Npb'></legend><bdo id='j4Npb'><pre id='j4Npb'><center id='j4Npb'></center></pre></bdo></b><th id='j4Npb'></th></span></q></dt></tr></i><div id='j4Npb'><tfoot id='j4Npb'></tfoot><dl id='j4Npb'><fieldset id='j4Npb'></fieldset></dl></div>

            <small id='j4Npb'></small><noframes id='j4Npb'>

            <tfoot id='j4Npb'></tfoot>

              <bdo id='j4Npb'></bdo><ul id='j4Npb'></ul>

              <legend id='j4Npb'><style id='j4Npb'><dir id='j4Npb'><q id='j4Npb'></q></dir></style></legend>
                  <tbody id='j4Npb'></tbody>

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

                  问题描述

                  我心狠手辣

                  $ 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 时,migrateschemamigration 命令没有出现在列表中.

                  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:

                  1. 管理命令必须以文件形式存在于普通目录path..to..south/management/commands(未压缩)中.
                  2. 尝试手动查找并删除 south 的旧安装.一个常见的问题是,某个软件包的一个版本已通过 easy_install(压缩)或通过python setup.py install"手动安装,但 pip 没有卸载它并第二次安装它.
                  3. 在 python 路径中仅使用绝对目录.如果可能,请不要在环境中或通过自定义的 manage 或 settings.py 更改安装程序和运行 Django 之间的 python 路径.一些 manage.py 或 settings.py 使用的 python 路径与包安装程序使用的路径不同,例如添加 "."或.."在其他目录之前.您的项目中的 ... 中不应有其他 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.

                  主要需求调查示例:

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

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

                  上一篇:如何为可重用的 Django 应用程序进行迁移? 下一篇:Django 1.8 测试问题:ProgrammingError: 关系“auth_user"不存在

                  相关文章

                1. <legend id='ozoIR'><style id='ozoIR'><dir id='ozoIR'><q id='ozoIR'></q></dir></style></legend>
                2. <i id='ozoIR'><tr id='ozoIR'><dt id='ozoIR'><q id='ozoIR'><span id='ozoIR'><b id='ozoIR'><form id='ozoIR'><ins id='ozoIR'></ins><ul id='ozoIR'></ul><sub id='ozoIR'></sub></form><legend id='ozoIR'></legend><bdo id='ozoIR'><pre id='ozoIR'><center id='ozoIR'></center></pre></bdo></b><th id='ozoIR'></th></span></q></dt></tr></i><div id='ozoIR'><tfoot id='ozoIR'></tfoot><dl id='ozoIR'><fieldset id='ozoIR'></fieldset></dl></div>

                      <bdo id='ozoIR'></bdo><ul id='ozoIR'></ul>

                    <tfoot id='ozoIR'></tfoot>

                      <small id='ozoIR'></small><noframes id='ozoIR'>