views:

30

answers:

2

Hi,

I am trying to install Django on Windows XP. Here is what I did:

(1) Downloaded and installed Python 2.7 from

http://python.org/ftp/python/2.7/python-2.7.msi

in C:\Python27


(2) Downloaded Django 1.2.1 from

http://www.djangoproject.com/download/1.2.1/tarball/


(3). After unzipping the file I placed Django's folder inside Python's site packages folder as below:

C:\Python27\Lib\site-packages\Django-1.2.1


(4). Now when I try to run "setup.py" in Django folder, I get the following error:

Traceback (most recent call last):
  File "C:\Python27\Lib\site-packages\Django-1.2.1\setup.py", line 48, in <module>
    root_dir = os.path.dirname(__file__)
NameError: name '__file__' is not defined

Screenshot can be seen below: alt text

What am I doing wrong?

Thanks

+1  A: 

Delete C:\Python27\Lib\site-packages\Django-1.2.1

Unzip tarball anywhere you want, then copy "django" subfolder from unpacked tarball into c:\Python27\lib\site-packages\, and you're done. You don't need to run setup.py actually.

If you want to install using setup.py, then open your command shell (press Win+R, type "cmd" and press Enter), change into dir you unpacked archive to (e.g. c:\archive\Django-1.2.1), and run "C:\Python27\python.exe setup.py install" without quotes.

Important note: you must run command shell with administrator privileges.

fuwaneko
I followed your second method and it worked. Thanks!
Ali
+2  A: 

Alternative method

  1. Install easy_install : http://pypi.python.org/pypi/setuptools
  2. Add C:\Python27\Scripts to your system path
  3. Open a command line and enter easy_install django

easy_install is defintely my favorite method for installing python modules.

luc
Thanks..this is very helpful tool....I have installed it
Ali