【发布时间】:2014-06-08 13:35:32
【问题描述】:
我在 django 中编写了一个脚本,将保存在数据库中的排队电子邮件发送给用户。有一个管理命令应该由 crontab 每小时调用一次以发送电子邮件。但是,每当执行 crontab 作业时,我都会收到以下错误:
django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module: libpq.so.5: cannot open shared object file: No such file or directory
我的 django 应用程序运行良好,没有任何错误。但是运行 crontab 失败。以下是我的 crontab 配置:
0 * * * * source /opt/portal/virtEnv/bin/activate && python /opt/portal/websource/manage.py send_queued_messages --limit=1
有人知道如何解决这个问题吗?
【问题讨论】:
-
crontab 有不同的环境变量。试试
0 * * * * env > /tmp/env.txt看看缺少哪个变量?
标签: python django crontab psycopg2