Nice cheat sheet, but I'm not sure that it helps our Windows user.
I believe, that on windows, you can check the path by, at a command,
or more likely, cmd,
prompt, typing:
echo %PATH%
It's actually set, and you can check it in, the my computer properties
tool. That is, right click
on my computer, choose properties. (There's another way to get to
this, from the control
panel, I think, but I don't remember the details.) On one of the tabs
there's a button labeled
something like "Advanced Settings", which opens a sub tool that lets
you set two lists from
which the path is made, one system wide, the other user specific.
I don't actually suggest adding the directory in which django-admin.py
exists on the path,
but you ought to have at least one directory on it with the philosophy
of the *nix /usr/local/bin,
that is, product installers don't know about it, and won't put stuff
there, or remove stuff there,
or replace stuff there.
Once you have such a directory, you could go to the effort of figuring
out how to make the
Windows equivalent of a symbolic link, but you can also just copy the
file (it's not very big).
One downside of this approach in general is that if you later upgrade
django, you have to
separately remember to re-copy this file, since the django installer
(or tarball or zip) doesn't
know about it.
But a bigger problem on Windows is that on windows .py files are not
an executable type.
They need to be run as an argument to the (appropriate version, should
you someday get
fancy and be developing different things using different versions of
python, or) python.exe
program. Now, it does work when you double click on a .py file in the
GUI, because that
extension is registered with the GUI as being "opened" with
python.exe, but that registration
does not extend (unless things have changed) to where cmd.exe looks
for the programs that
you ask it to run. And you need to run django-admin.py from the
command line so that you
can give it arguments, like "startproject" and "foo".
So what I would suggest is a batch file (the authorship of which is
beyond my current windows
chops), that you place in the above mentioned on the path directory, maybe named
'django-admin.bat', which, inside, invokes your choice, by using full
path, of python.exe, on,
again using full path, django-admin.py, and passing along (this is the
part that I don't know
how to do in a bat file) any arguments that were on the batch file's
command line as additional
arguments to python.exe, after the full path to django-admin.py .
Alternatively, starting a project is relatively rare, and it is the
only thing that I've needed
django-admin for. Everything else can be done with manage.py, and you
should be cd'ed to
it's directory whenever using it anyway, so it's (relative) path
becomes trivial. It still needs to
be an argument to python, though, rather than being the command itself.
(As an aside, the reason that this is all simpler on *nix is that any
file can be marked as an
executable, and if it is, the OS looks at the first two bytes in the
file, and if they are '#!', it treats
the first line of the file (which had better end with '\n', not '\r\n'
if your fond of editing stuff on
windows and running it on *nix) as a command to run instead, passing
the file itself to the
command being run. Because most "interpreters", such a python, have
been arranged to
treat '#' as the beginning of a comment, this extra line does not confuse them.)
Bill
On Mon, Nov 23, 2009 at 7:40 AM, Tim Chase
<[email protected]> wrote:
>> I'm tryin to install django on my windows machine, but I got stuck in
>> the followin line "Consider symlinking to django-admin.py from some
>> place on your path, such as /usr/local/bin." I'm not too techno-
>> savvy...can someone point me in the right direction as to what that
>> means and/or how I go about doing that???
>
> This assumes you're running a *nix-like OS instead of Windows
> (you can make links in Windows but it's a pain).
>
> Executive Cheat-code for the impatient:
> =======================================
>
> bash$ ln -s /path/to/existing/django-admin.py
> /some/place/on/path/django-admin.py
>
>
>
> More detailed explanation:
> ==========================
> In most instances, the Django install doesn't drop its
> "django-admin.py" outside its own subdirectory. This means that
> to run it, you have to specify its full path
>
> bash$ /path/to/django-admin.py startproject foo
>
> If, however, it's on your path (the list of places your shell
> looks to find executables), you can get away with just typing
>
> bash$ django-admin.py startproject foo
>
> The best geeks are lazy, so that 2nd one appeals after you've
> typed the full path more than once. Therefore the docs suggest
> that you create a link from its existing loction to some place on
> your path. You can show your path with
>
> bash$ echo $PATH
>
> Because this is likely outside the domain of your OS's stock
> install, it's recommended you not link into a "system" directory
> (usually /bin or /usr/bin are controlled by your package manager)
> but rather to use either a system-wide location like
> /usr/local/bin or /opt/bin which is designed for add-on programs
> outside of the stock-OS. This would be for all users on the
> system. If, however you just want it for yourself, many folks
> have a ~/bin in their home directory for just this purpose.
> However, you have to make sure you have that on your path. So
> for example, in my .bash_profile or .bashrc I might have lines like
>
> PATH=$HOME/bin:$PATH
> export PATH
>
> to add ~/bin to my $PATH, and then create a link from the
> existing django-admin.py into that folder with
>
> bash$ ln -s /path/to/django-admin.py ~/bin/django-admin.py
>
> Lastly, as one more cheap trick, you don't need to keep the same
> name, so I tend to drop the ".py" when I do that:
>
> bash$ ln -s /path/to/django-admin.py ~/bin/django-admin
>
> so I can just type
>
> bash$ django-admin startproject foo
>
> Hope this helps explain so you can tweak as you need,
>
> -tim
>
>
>
>
>
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=.
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=.