HowTo Install Python + Django + Aptana Studio on Windows

来源:互联网 发布:2016中超网络直播乐视 编辑:程序博客网 时间:2024/05/17 04:32

Installing Python and Django in windows maybe a challenge that is a little bit more complicated than running severalinstallers. In this article, I will explain how to get Python, Django, andAptana Studio running smoothly on windows.

1. Install Python

- Go to http://www.python.org/download/ anddownload the Python 2.6.4 Windows Installer

NOTE: Make sure its 2.6! 3.1 Doesn’t workwell with django yet.

- Execute and install what you’ve justdownloaded with the default options.

Now for these different operationalsystems:

For Windows XP:

1. Start -> Control Panel -> System-> Advanced
2. Click on Environment Variables, under System Variables, find PATH, and clickon 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 ERASEANYTHING!. Also make sure you have a semicolon (;) before what you write.

2. Make sure Python runs .py filescorrectly

Some systems refuse to add the .py fileassociation correctly. Just in case, execute the following steps to make Pythonrun .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 editthe .py file extension

- Look for the PY extension, select it, andclick “Advanced”
- Select the “open” action, and click “Edit”
- Make sure you have

“C:\Python26\python.exe” “%1″ %*

in the “Application used to perform theaction” box

- Click OK on everything

3. Installing Django

- Go tohttp://www.djangoproject.com/download/ and download the version that best suitsyou. Version 1.1.1 works fine for me.

- Extract the files to a folder. WinZipwill 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 showup, type in cd “[directory_of_django]“. For example:

cd “C:\Documents and Settings\lsa\MyDocuments\Dev\libs\python\Django-1.1.1″

- type

setup.py install

4. Make sure you have a java JREinstalled

- 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 aversion of eclipse that already comes with HTML and CSS editors, and installingPyDev in it is really easy.
However, those instructions can be easily adapted to PyDev as well.

- Go to http://www.aptana.org/studio/downloadand download the standalone full installer version.

- Install aptana and fire it up.

- Click on the big plug-ins tab. Scroll allthe 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/downloadsand download

MySQL-python-1.2.2.win32-py2.6.exe, if youhave a 32 bit OS or

MySQL-python-1.2.2.win-amd64-py2.6.exe, ifyou 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 anydirectory 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 tellsyou 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 itsupposed to. Congratulations!

原创粉丝点击