最近在django上安装了芹菜,它工作正常,但我意识到我的cron(我的意思是通常的cron,而不是芹菜的周期性任务)命令不会执行。 我在我的cron线是这样的:Django:芹菜导入导致执行cron命令时出现错误
sudo -u someuser python /home/someuser/django_proj/manage.py somecommand --settings=someapp.settings
而且它工作得很好。但是,如果我添加“导入djcelery”来的settings.py,我都会有这样的错误:
Unknown command: 'somecommand'
Type 'manage.py help' for usage.
我在做什么错? P.S.我知道,芹菜有周期性的任务,但我现在不能使用这个功能。
另外,我有 “common_settings.py” 文件,someapp/settings.py有这样的代码:
from common_settings import *
如果我添加 “导入djcelery” 到common_settings.py我会得到这个:
Error: Can't find the file 'settings.py' in the directory containing '/home/someuser/django_proj/manage.py'. It appears you've customized things. You'll have to run django-admin.py, passing it your settings module. (If the file settings.py does indeed exist, it's causing an ImportError somehow.)
它试图找到django_proj文件夹中的设置,但我在这里没有任何设置。
感谢您的回复。我不确定是否因逗号或其他因素而发生此错误。 “ok”设置文件和“破损”设置文件之间的区别在于“破损”文件具有“导入djcelery”,就这些。 – Geslot