Here is an example of a complete script that does this:

http://blog.awarelabs.com/2007/using-django-models-in-batch-jobs/

You will need to know the complete path to Django.  In the CRON you
now do not need to set PYTHONPATH for Django because it is set in the
actual script.

-Paul

On Sep 24, 10:05 am, Matt McCants <mmcca...@freelancestar.com> wrote:
> Greetings all,
>
> I'm having an issue running a custom command as a cron. Most resources
> I've read have said that you can run your command from cron by simply
> using the following syntax:
>
> python manage.py custom_command_name
>
> Frustratingly, that does not work for me. It results in "Unknown
> command: 'custom_command_name'" Further attempts such as:
>
> /usr/bin/python /path/to/my/project/manage.py custom_command_name
>
> or any variation fail. If I run:
>
> python /path/to/my/project/manage.py help
>
> It executes, but my custom command does not show up.
>
> The custom command works fine when I call it from within the project
> directory.
>
> I suspect it has something to do with PythonPaths. I'm pretty new to
> both Django and Python, so any help is greatly appreciated.
>
> Thanks,
> Matt McCants
>
> This message is confidential, intended only for the named recipient(s) and 
> may contain information that is privileged or exempt from disclosure under 
> law. If you are not the intended recipient(s), you are notified that the 
> dissemination, distribution, or copying of this message is strictly 
> prohibited, and that this message should be deleted from your system. The 
> Free Lance-Star Publishing Company accepts no liability for the content of 
> this message, or for the consequences of any actions taken on the basis of 
> the information provided. If you receive this message in error, or are not 
> the named recipient(s), please notify the sender and delete the document from 
> your computer.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to