How To Install Python + Django + Aptana Studio on Windows
Installing Python and Django in windows may be a challenge that is a little bit more complicated than running several installers. In this article, I will explain how to get Python, Django, and Aptana Studio running smoothly on windows.
1. Install Python
- Go to http://www.python.org/download/ and download the Python 2.6.4 Windows Installer
NOTE: Make sure its 2.6! 3.1 Doesn’t work well with django yet.
- Execute and install what you’ve just downloaded with the default options.
Now for these different operational systems:
For Windows XP:
1. Start -> Control Panel -> System -> Advanced
2. Click on Environment Variables, under System Variables, find PATH, and click on it.
3. In the Edit windows, modify PATH by adding “;C:\Python26;C:\Python26\Scripts”. Make sure you ADD it. DO NOT ERASE ANYTHING!. Also make sure you have a semicolon (;) before what you write.
For Windows Vista:
1. Right click “My Computer” icon
2. Choose “Properties” from context menu
3. Click “Advanced” tab (“Advanced system settings” link in Vista)
4. In the Edit windows, modify PATH by adding adding “;C:\Python26;C:\Python26\Scripts”. Make sure you ADD it. DO NOT ERASE ANYTHING!. Also make sure you have a semicolon (;) before what you write.
2. Make sure Python runs .py files correctly
Some systems refuse to add the .py file association correctly. Just in case, execute the following steps to make Python run .py files:
- Open Windows Explorer
Windows XP:
- Go to View > Folder Options > File Types tab
Windows Vista:
- Download http://sourceforge.net/projects/types/ and use this program to edit the .py file extension
- Look for the PY extension, select it, and click “Advanced”
- Select the “open” action, and click “Edit”
- Make sure you have
“C:\Python26\python.exe” “%1″ %*
in the “Application used to perform the action” box
- Click OK on everything
3. Installing Django
- Go to http://www.djangoproject.com/download/ and download the version that best suits you. Version 1.1.1 works fine for me.
- Extract the files to a folder. WinZip will do the job. Please REMEMBER THE FOLDER WHERE YOU EXTRACTED DJANGO.
- Open a command prompt (Start > Run > Type in “cmd” and press OK)
- In the black window that is going to show up, type in cd “[directory_of_django]“. For example:
cd “C:\Documents and Settings\lsa\My Documents\Dev\libs\python\Django-1.1.1″
- type
setup.py install
4. Make sure you have a java JRE installed
- Go to the command prompt again (Start > Run > cmd) and type in
java -version
- If the version is anything above 1.6, you’re good. If not, go to www.java.com and download it.
5. Installing aptana studio
I really like aptana studio because it is a version of eclipse that already comes with HTML and CSS editors, and installing PyDev in it is really easy.
However, those instructions can be easily adapted to PyDev as well.
- Go to http://www.aptana.org/studio/download and download the standalone full installer version.
- Install aptana and fire it up.
- Click on the big plug-ins tab. Scroll all the way down where you will see “Aptana PyDev”. Click on “Get it”
- Select PyDev on the screen that opens, click next, accept the license, and click finish.
- After Aptana restarts, go to Window > Preferences > PyDev > Interpreter – Python and click “Auto-Config”
- Click OK on everything else
6. Installing MySQL for Python
If you are going to use django with MySQL, you will probably need to perform those steps:
- Go to http://www.codegood.com/downloads and download
MySQL-python-1.2.2.win32-py2.6.exe, if you have a 32 bit OS or
MySQL-python-1.2.2.win-amd64-py2.6.exe, if you have a 64 bit OS
In doubt, download the first one.
- Install it.
7. Testing the installation
Now we are ready for testing.
- Open the command prompt, and cd to any directory you like. I strongly recommend to go to an empty directory.
- type
django-admin.py startproject mysite
cd mysite
manage.py runserver
- Wait until you get an output that tells you the server is running.
- Fire up your web browser and go to http://localhost:8000
- If you get an “It Worked!” message, it means everything is working as it supposed to. Congratulations!
Shaho said,
Wrote on February 13, 2010 @ 12:49 am
Thanks a million! EXCELLENT. It Worked!
s17 said,
Wrote on May 24, 2010 @ 11:27 pm
you da-man!