4

I'm new to Python and Django. In fact, I'm new to web framework too. I'm using Windows 7 OS and have installed Django.

I knew Django has been installed successfully. When I go to tutorials, this command, "django-admin.py startproject appproject" always suggested to be run before starting the project.

However, when I run this command, django-admin.py was not recognized as keyword. Can anyone please help me to see what's wrong here?

1 Answer 1

7

On windows python scripts get installed to C:\Python27\Scripts (by default for Python2.7). However the python installer does not automatically Add this location to your PATH. What you need to do is either replace any call to django-admin.py with C:\Python27\Scripts\django-admin.py, or add it to your path. You can do that by:

  1. Open your Start Menu and Locate My Computer, Right Click on it and choose Properties
  2. On the left hand side select "Advanced System Settings".
  3. Next click on the "Environment Variables" button.
  4. Look in the bottom scroll box until you find one named PATH. Select this and hit Edit.
  5. To the end of the current value, append ";C\Python27\Scripts".
  6. Close/Save everything, including your cmd.exe prompt. When you reopen it C:\Python27\Scripts should be on your path, and django-admin.py should work.
Sign up to request clarification or add additional context in comments.

1 Comment

Hi Donald, Thanks for this. It seems that my problem was relating to not adding the location to the PATH. haha.. Btw, if you would edit a bit so that other people that may need it, will not overlook. On your point no. 5, it should be "C:\Python27\Scripts" in case some people overlooked and just copied pasted to their PATH. :)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.