Django的manage.py显示旧命令 [英] Django's manage.py shows old commands

查看:111
本文介绍了Django的manage.py显示旧命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写自己的whl程序包,在创建了一些新的管理命令并删除了一些旧的命令后,我对自己感到非常满意.除了构建我的wheel-package(使用setup.py bdist_wheel)并将其安装在测试服务器上(使用pip install -U project-2.0b3-py2.py3-none-any.whl)之后,我注意到manage.py的帮助仍然显示了旧命令.它甚至会尝试运行旧命令,因此那里有一些旧东西,但是我不太确定为什么或如何.

I am coding my own whl-package and after creating some new management-commands and deleting some old ones I was pretty happy with myself. Except after building my wheel-package (with setup.py bdist_wheel) and installing it on my test server (with pip install -U project-2.0b3-py2.py3-none-any.whl), I noticed that the help of manage.py still show the old commands. It will even try to run the old commands, so there is some old stuff there, but I was not quite sure why or how.

我尝试卸载而不是使用pip uninstall project进行升级,并尝试使用pip freeze列出已安装的软件包,以确保所有内容均已消失.甚至尝试运行旧命令,如果未安装该软件包,它们将正确失败.

I tried uninstalling instead of upgrading with pip uninstall project and listing installed packages with pip freeze to make sure it was all gone. Even tried to run the old commands, which would correctly fail when the package was not installed.

这些旧命令从哪里来?

推荐答案

多田.找到了. TL; DR:运行setup.py clean --all bdist_wheel.


因此,卸载软件包后命令消失时,它一定是软件包中的内容.我确认这样做

Tada. Found it. TL;DR: run setup.py clean --all bdist_wheel.


So when the commands were gone after uninstalling the package, it must be something in the package. I confirmed that by doing

> strings project-2.0b3-py2.py3-none-any.whl | grep old_command

确实找到了我的旧命令的痕迹.因此它们从某处内置到我的程序包中.我移到开发箱并运行

which indeed found traces of my old command. So they got built into my package from somewhere. I moved to my dev-box and ran

> find . -iname *old_command*
./build/lib/project/management/commands/old_command.py

虽然我已经从项目中删除了文件,但显然它仍在build-目录中.一个简单的清理将不会摆脱它,但是clean --all会去除它.方便地,它可以组合为

While I had already deleted the file from my project, it was obviously still in the build-directory. A simple clean will not get rid of it, but clean --all does. Conveniently, it can be combined to

setup.py clean --all bdist_wheel

这篇关于Django的manage.py显示旧命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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