Thanks for the quick and helpful answers. On 9 feb, 19:37, Bill Freeman <ke1g...@gmail.com> wrote: > If you're running on *nix (including Os/X, probably) you have a few options. > Someone else will have to help if it's Windows without cygwin. > > The easy way, if it does all that you need, is to deploy, instead of a > python file > a shell script. It can cd to the appropriate directory, then run the > the appropriate > (and not on the general PATH) command you want to run. The shell is perfectly > capable of collecting command line arguments and passing them on. > > You can rig your python script to start thusly: > ---------- > import sys, os > sys.path[0] = 'path_to_your_project' > os.chdir(sys.path[0]) > ----------- > certainly before importing any django stuff. The os.chdir() call may > not be necessary, > but can't hurt. > > Both of these have the disadvantage of the script needing to know the > path to your > project, but something has to know it. > > Bill > > On Tue, Feb 9, 2010 at 1:34 PM, Tim Daniel <redarrow...@hotmail.com> wrote: > > I'm trying to launch custom admin commands with acron(outsidethe > > project path). I'm running Django 1.1.1. I've tried to add the -- > > pythonpath='path_to_my_project' option, but it doesn't work either. > > > When I call path_to_my_project/manage.py my_command -- > > pythonpath='path_to_my_project' from inside the project path it all > > goes well, but when I'moutside(cwd). It only gives a > > > Unknown command: 'my_command' > > Type 'manage.py help' for usage. > > > error. > > I've put a trace inside the manage.py and followed it until I got to: > > > /usr/lib/pymodules/python2.6/django/core/management/__init__.py > > Method: def find_management_module(app_name) > > > if os.path.basename(os.getcwd()) != part: > > raise e > > > The problem is that os.path.basename(os.getcwd()) returns my current > > working directory(the last part of it) that will never be equal to > > 'part' that is the project_name. Only if you are inside your project > > path. > > > So because of that all my custom commands are never 'discovered'. > > > I've been stucked here yesterday on other machine but somehow it > > solved magically!! > > I hope I'm doing some really stupid noob error here and so it can be > > easily solved. > > > Regards, > > > Tim D.G. > > > -- > > 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 > > athttp://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.