Ali
Ali

Reputation: 511

Django installation problem on Windows

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

Upvotes: 1

Views: 2389

Answers (3)

luc
luc

Reputation: 43096

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.

This will pull the latest version of Django off the PyPI website, and install it in that directory.

easy_install is definitely my favorite method for installing python modules.

Upvotes: 2

Daniel Lopez
Daniel Lopez

Reputation: 3391

An alternate all-in-one open source Windows installer for Django that installs Apache, Python, etc.: Djangostack

Upvotes: 1

fuwaneko
fuwaneko

Reputation: 1165

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.

Upvotes: 1

Related Questions