If you are calling this from, for example, crontab note that each line in crontab is executed in its own subshell, so you have the choice of setting PYTHONPATH, or (my personal favorite because it works with so many kinds of scripts) you can cd to the project directory and execute the script as ./manage.py custom, by separating the cd and ./manage.py with a semicolon. Too, if you are doing this from a bash (or sh or, probably, csh) script, commands run inside parentheses run in a sub shell, so you can do the cd, semi, manage trick, and when the subshell exits, the rest of your script is still running in its original directory. Finally, if this is a command line utility that you want to run from wherever and just have on the path, create a sh (or bash) script that cd's and runs it instead, and put that on the path. This last works on windows too, using bat files (or whatever the cmd.exe equivalent is).
On Tue, Dec 22, 2009 at 5:59 AM, Justin Steward <althalu...@gmail.com> wrote: > I'm at a loss as to understand why, but I've worked out what I need to > add to pythonpath. > > PYTHONPATH=/home/user > > i.e. The pythonpath needs to include NOT the project's root, but the > directory one level ABOVE that for custom commands to work properly... > > Thanks for the help guys. > > ~Justin > > -- > > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@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. > > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.