0

On my project i have an app : my_app with Managment command : my_command.py

On SSH i try : my/folder/project/and/app/python2.4 manage.py my_command all is ok

but if i try : python2.4 /my/folder/project/and/app/manage.py my_command, manage.py doesn't know my command...

i try to run my command on a crontab..

Thx laurent

laurent
  • 660
  • 2
  • 8
  • 19
  • Is `python2.4` in a virtualenv? – voithos Oct 10 '12 at 15:10
  • the problem is i doesn't know... my server is on centos 5.5 and i m not a specialist.. so i try to do my best, to have python2.6 ans python2.4 ... anyay my django instal is only on python2.4... python alone run python2.6 but no django install on python2.6 ... very confuse to me my server setup... – laurent Oct 10 '12 at 15:52
  • In a shell, type `which python2.4`, and it should tell you where Python 2.4 is located. Then, in your crontab, use the full path to Python 2.4 for the command. (e.g. `/path/to/python2.4 /my/folder/project/and/app/manage.py my_command`) – voithos Oct 10 '12 at 16:16
  • I do that ... found /usr/bin/python2.4.. so try on console : `/usr/bin/python2.4 /var/www/vhosts/mydomaine/subdomains/django/httpdocs/myprojects/manage.py my_command` --> unknown command – laurent Oct 11 '12 at 08:04

1 Answers1

0

In my experience I had this kind of issues for several reasons.

I'd check first the python interpreter used. If you are using virtualenv or something like that you should ensure you are using the correct python executable.

If your server has selinux, you should ensure it's not denying the cron to read some files.

I also had an issue like this because the settings file (I used a separate setting file to make it less verbose) didn't exist.

esauro
  • 1,276
  • 10
  • 17