Panupat
Panupat

Reputation: 462

How to make Python knows the path to look for .py files?

Just started trying to learn Python and Django today. Following their documentations I was able to install Python and Django and got them up and running. I'm running Apache 2.2 on on Windows 7 by the way.

I got to the part in the official tutorial that tells me to cd to the directory I want for my project and run this command

django-admin.py startproject mysite

However I can't just run that command as is. I need to run it like this

python c:\Python27\Scripts\django-admin.py startproject mysite

Am I suppose to type out the whole thing like this? Or is there some settings I miss that will let me run the .py file without the python C:\Python27\Scripts\ part in front?

Upvotes: 0

Views: 223

Answers (2)

Drew D.
Drew D.

Reputation: 411

Try running:

python django-admin.py startproject mysite

If that don't work, try adding C:\Python27\ to the command search path

Upvotes: 0

payne
payne

Reputation: 14187

If you want to just be able to type django-admin.py, two things need to be set up:

  • The directory containing it needs to be in your PATH.
  • You need to make sure that the .py extension is associated with the Python interpreter. This is normally done during the installation of Python.

How to set the PATH on Windows 7: http://geekswithblogs.net/renso/archive/2009/10/21/how-to-set-the-windows-path-in-windows-7.aspx

How to make sure .py is associated with Python: http://docs.python.org/faq/windows.html

Upvotes: 5

Related Questions