WebFaction
Community site: login faq

Hi,

I am not able to setup a cronjob to run django custom commands. When I run same command in command line it works but when cron is running it is giving weird error related to very different block of code that it even should.

Here is what I run in shell and it works:

python /home/my_account/webapps/my_project_name/myproject/manage.py emit_notices --pythonpath=/home/my_account/webapps/my_project_name --settings=myproject.settings_prod

So that will send the emails queued by django-notifications app.

And my cronjobs looks like:

PYTHONPATH=/home/my_account/webapps/my_project_name/lib:/home/my_account/webapps/my_project_name/lib/python2.6:/home/my_account/webapps/my_project_name
DJANGO_SETTINGS_MODULE=myproject.settings_prod

*/1 * * * * python /home/my_account/webapps/my_project_name/myproject/manage.py emit_notices --pythonpath=/home/my_account/webapps/my_project_name --settings=myproject.settings_prod > /home/my_account/cronjobs.log 2>&1

The error in cronjobs.log points to my UUIDField in utils.py and gives me

from django.utils import uuid
ImportError: cannot import name uuid

asked 10 Mar '11, 15:03

tiparkki
2138
accept rate: 0%


I was able to fix it.

So instead of

*/1 * * * * python

I had to use

*/1 * * * * /usr/local/bin/python2.6

and works like a charm

permanent link

answered 10 Mar '11, 15:37

tiparkki
2138
accept rate: 0%

Glad to hear you figured it out.

(10 Mar '11, 16:12) johns
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×910
×81

question asked: 10 Mar '11, 15:03

question was seen: 6,650 times

last updated: 10 Mar '11, 16:12

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2020 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM