1

I had a command all set up and working, then I set up a Cron job for it and now it disappeared from manage.py help's list of all available commands.

It is under /app/management/commands/feed_update.py

and it has a Command(BaseCommand) class with a handle() function.

The problem is that my script has dependencies to app.models so I can't even run the script to see if something is wrong and why manage.py won't pick it up automatically.

Is there a way to force manage.py to find the script?

Thanks.

Edit 1: I just tried doing

manage.py shell

>> import app.management.commands.feed_update as fu
>> fu.Command.handle(fu.Command())

and everything worked fine. I just don't understand why it wont let me run it through manage.py

I have __init__.py files in every folder..

Edit 2: The app is installed in Settings.py and is my main app that serves my web content so I am absolutely certain it is installed.

It can't find the command either in Cron or when I go in through the terminal (even though my other apps' Commands show up correctly).

4

2 回答 2

0

我刚刚解决了一个几乎与此相同的问题,除了我使用的是django-admin.py. 在我的开发机器上完美运行的管理命令没有出现在django-admin.py不带参数运行时显示的命令列表中。事实证明,如果您希望自定义管理命令起作用,您需要django-admin.py从项目的根文件夹中运行。

于 2011-08-11T20:07:47.870 回答
0

它需要位于 中列出的应用程序中settings.INSTALLED_APPS

如果它似乎已经存在,您确定 cron 作业使用了正确的 settings.py 吗?

于 2011-02-08T17:12:45.220 回答