Windows error when installing Django


After all I started learning Django. Just installed it. The first method to check if it got installed correctly is to write at the python shell:
import django

If this statement runs without reporting any errors, then be happy, your installation is complete.

The next step is to create a project. On windows7 (I am using), when I wrote the command on commandline:

django-admin.py startproject testproj ## should create a directory named testproj

I got the most frustrating error:

C:\Users\Ayush\Documents\Django>django-admin.py startproject testproject
'django-admin.py' is not recognized as an internal or external command,
operable program or batch file.

I was confused. I just imported django on my shell and it worked fine!. Then I started on the quest of this “django-admin.py”. I searched the site-packages directory of python (didn’t look deep the first time), and didn’t find anything.

Then I searched a bit on the net and someone was giving an advice to put django-admin.py in the scripts folder of python. Since I installing a very new version (1.3), I checked the Scripts folder and found it there. 🙂

So, anyone finding similar error, just redirect yourself to the Scripts folder (C:\Python27\Scripts\testproj) and execute the command there:

django-admin.py startproject testproject

Though this is not the place we wanted to create our test project directory, but something is better than nothing.. 🙂

An addition: Some people might not be able to start projects with the aforementioned command. Instead try this:

>python.exe django-admin.py startproject testproject

My friend on WinXP solved his problem with this command.

Advertisements
Explore posts in the same categories: Python

Tags: , ,

You can comment below, or link to this permanent URL from your own site.

5 Comments on “Windows error when installing Django”

  1. SmileyChris Says:

    So the solutions to run it from anywhere are to:

    1. Put the scripts folder on your path, or

    2. use the full path when running django-admin.py (you won’t need it that often anyway) e.g. C:\work> C:\Python27\Scripts\django-admin.py startproject nyancat

  2. Rajapk Says:

    I have everything set right, but when I execute the command at c:\>django-admin.py startproject mysite, it shows me the command usage instructions, and not doing anything

  3. Rajapk Says:

    Also I am useing windows 7 64, python 2.7, Django 1.4.1


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: