At 2011-12-31 18:47:13 -0800, Chris Kavanagh wrote:
> Forgive my ignorance, but if that's the way it's supposed to work
> (script must be in current dir) then how would Python know to run
> django-admin.py if I'm NOT in the same directory it is
> (Python27\Scripts\)??? In other words, the tutorial says to create a
> mysite dir somewhere, NOT in the Python27\Scripts dir. So how would it
> work then if  Python27\Scripts\ isn't my current working dir (ie:
> mysite isn't in the Scripts dir)??

Three options:

Either you run
    python C:\path\to\django-admin.py startproject mysite
from whatever directory you want, to run an arbitrary Python script 
anywhere on your machine.

Or, with other scripts, from the directory where the Python script is, 
you can generally do
    python some-script.py C:\path\to\some\target
depending how the script itself is set up -- the django-admin.py 
doesn't let you do this, it wants only to create a project in the 
current directory.

Or (what you're encouraged to do in this case) the django-admin.py 
script is set up somewhere in your lookup PATH. The lookup PATH is the 
list of directories in which commands live, and so when asked to run a 
particular command the shell looks in those directories and if it 
finds the command you wanted runs it, no matter where you are. To get 
the django-admin.py script in the PATH so you can run it from anywhere 
without a full path either you install the script to a directory which 
is already in your PATH (I think on Windows C:\windows\system32 is one 
such directory) or the Django directory containing the script is added 
to your PATH.

There might have been instructions to do that when you installed 
Django, or perhaps it was done as part of an installation script.

The fact that this path exists is the reason you can run commands like 
"python" itself from anywhere, if it's set up properly.

-- 
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