0

django-archive を使用して、crontab でサイトのバックアップを実行するのに問題があります。

crontab ファイル:

0 5 * * * python ~/SBGBook/gbsite/manage.py archive

エラー:

 Traceback (most recent call last):
     File "/home/jgates/SBGBook/gbsite/manage.py", line 17, in <module>
       "Couldn't import Django. Are you sure it's installed and "
    ImportError: Couldn't import Django. Are you sure it's installed and available $

ディレクトリにいる場合、python manage.py archiveコマンドはうまく機能しgbsite/ますが、ここには何らかのパスの問題があると思います。これはすべて、実稼働サーバーの venv で実行されています。

4

1 に答える 1

1

virtualenv から python インタープリターを使用してみてください:

0 5 * * * /path/to/virtualenv/bin/python ~/SBGBook/gbsite/manage.py archive
于 2016-09-04T15:39:14.360 に答える