Django "manage.py index" does not execute as cron job

I am trying to create a site using pinax. To index the models using djapian, I tried to run "manage.py index" as a cron job, but still getting a pinax error. "Error: No module name with name . " However, the task runs correctly when I run it from the shell. My definition of crontab is as follows:

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/mypath/test_project

# m h dom mon dow user  command
*/1 *   * * *   root    python /root/mypath/test_project/manage.py index >>/tmp/backup.log 2>&1

Can someone explain why I am getting this error?

+3
source share
2 answers

, , PYTHONPATH , "". DJANGO_SETTINGS_MODULE, .

script cron django:

#!/bin/sh
DJANGO_SETTINGS_MODULE=mysettings
export DJANGO_SETTINGS_MODULE

PYTHONPATH=/path/to/python_libs:/path/to/my_django_apps
export PYTHONPATH

/path/to/python /path/to/my_django_script
+6

ars, cron , . - script, , .

0

Source: https://habr.com/ru/post/1712171/


All Articles