我正在尝试运行 cron 来运行自定义 Django 管理命令。我在 DotCloud 上运行。
当 cron 运行时,我收到以下错误:
Traceback (most recent call last):
File "./manage.py", line 2, in <module>
from django.core.management import execute_manager
ImportError: No module named django.core.management
我认为这是因为 cron 在裸环境中运行,所以我尝试在同一个 cron 中手动设置 PYTHONPATH。这是那个命令...
PYTHONPATH=/home/dotcloud/env/lib/python2.6/site-packages/setuptools-0.6c11-
py2.6.egg:/home/dotcloud/env/lib/python2.6/site-packages/pip-1.0.1-
py2.6.egg:/home/dotcloud/current:/home/dotcloud/env/lib/python2.6:/home/dotcloud/env/lib/python2.6/plat-linux2:/home/dotcloud/env/ lib/python2.6/lib-tk:/home/dotcloud/env/lib/python2.6/lib-old:/home/dotcloud/env/lib/python2.6/lib-dynload:/usr/lib/python2 .6:/usr/lib64/python2.6:/usr/lib/python2.6/plat-linux2:/usr/lib/python2.6/lib-tk:/usr/lib64/python2.6/lib-tk :/home/dotcloud/env/lib/python2.6/site-packages:/usr/local/lib/python2.6/dist-packages/virtualenv-1.6.1-py2.6.egg:/usr/local/ lib/python2.6/site-packages:/usr/local/lib/python2.6/dist-packages:/usr/lib/python2.6/dist-packages:/usr/lib/pymodules/python2.6
错误仍在发生,我不确定发生了什么。非常感谢任何建议。
谢谢。