02 May

django and virtualenv on Aptana Studio

Create a folder for storing Virtualenv environments

C:Usersamachefe>mkdir env
C:Usersamachefe>cd env

Create a virtual environment VCMS by running the virtualenv command.
C:>powershell
Windows PowerShell
Copyright (C) 2012 Microsoft Corporation. All rights reserved.
PS C:>
PS C:Usersamachefeenv>virtualenv vcms
New python executable in vcmsScriptspython.exe
Installing setuptools…………….done.
Installing pip……………….done.

In Microsoft Windows, before activating the virtual environment, ensure that the new environment is used by setting the Powershell execution policy
PS C:> Set-ExecutionPolicy RemoteSigned
PS C:> exit

Activate the virtualenv environment just created

PS C:Usersamachefeenv>vcmsScriptsactivate
(vcms) C:Usersamachefeenv>
(vcms) C:Usersamachefeenv>pip list

(vcms) C:Usersamachefeenv>pip show
ERROR: Please provide a package name or names.
(vcms) C:Usersamachefeenv>pip install django
Downloading/unpacking django
  Downloading Django-1.5.1.tar.gz (8.0MB): 8.0MB downloaded
   Running setup.py egg_info for package django

    warning: no previously-included files matching ‘__pycache__’ found under directory ‘*’
    warning: no previously-included files matching ‘*.py[co]’ found under directory ‘*’
Installing collected packages: django
  Running setup.py install for django

    warning: no previously-included files matching ‘__pycache__’ found under directory ‘*’
    warning: no previously-included files matching ‘*.py[co]’ found under directory ‘*’
Successfully installed django
Cleaning up…
Storing complete log in C:Usersamachefepippip.log


(vcms) C:Usersamachefeenv>

(vcms) C:Usersamachefeenv>pip list
Django (1.5.1)
(vcms) C:Usersamachefeenv>

Deactivate after installing

(vcms) C:Usersamachefeenv>deactivate
C:Usersamachefeenv>

Setting up Aptana Studio

One of the best (and free) IDEs for is Aptana Studio. Aptana Studio is a complete environment that includes extensive capabilities to build Ruby and Rails, PHP, and Python applications, along with complete HTML, CSS and JavaScript editing. Aptana is based on Eclipse, and has one of the best python plugin, PyDev.
It has gives you two options for download. You can either install Aptana on top of your pre-existing Eclipse installation (Eclipse Plug-in Version), or install a standalone version of Eclipse with Aptana pre-configured. I prefer the stand alone version

To create a new Django project in Aptana, go to File->New -> Other. Select the PyDev folder, and finally, the PyDev Django Project option, and click next. Give the project a name.

Under the Interpreter, click to configure a new interpreter.

Hit New… Add Name for the interpreter, and specify a path to your newly made virtualenv. Click Ok

manually select the C:Python27Lib folder. Click OK

Click OK, to close the Python interpreter selector and return to the New Project box.

Select the Interpreter you just created in the last step, and Click Next. Complete the Requirement to create a project.
To test the project, Click the Aptana Studio RUN bottom

Aptana Studio Run button

Check if the project was successful from the browser

NB: You can also add a new Python Interpreter from Preferences > PyDev > Interpreter – Python settings.