I’m getting more into using IDEs for development, and would like to use Aptana for my work with Django since I use it with everything else. The only problem is, out of the box, Aptana doesn’t know what to do with the Django libraries, and many of the tutorials currently floating around the web are very outdated.
I’ll take the initiative to do it myself. Here’s how to configure Aptana to work with Django (1.7.3) on Ubuntu 14.04.
Don’t install Django from Ubuntu’s repositories. It is very old and subject to break when you update the system. Instead:
sudo apt-get install python-pip sudo pip install django
You could take it a step further and set up virtualenv, but it’s overcomplicating things in this case. This solution is a very quick and very dirty way of getting set up and is only good if you don’t work with a variety of versions across a variety of projects.
Back in Aptana,
File > New > Other > PyDev > PyDev Django Project
Fill in the obvious fields. You’ll need to select “create links to existing sources” before Aptana will let you proceed since it still does not know where to find Django.
On the next screen, add an external source directory. Point Aptana to:
On the next screen, point Aptana to whatever database you’re using with this project or leave it as default to build against SQLite.
Finish the setup and Aptana will create the directory structure for you, as well as run the equivalent “python django-admin.py startproject whatever” command you normally use to kick off a Django project.
One last thing– for some reason, Aptana does not know where to find the manage.py file needed to maintain your project; it gets entered incorrectly in the environment variable. Let’s fix it.
Right click on your project root and go to Properties. Under PyDev – PYTHONPATH, check out the String Substitution Variables tab. Remove the “src/” prefix from “src/manage.py,” hit Apply and OK.
You should now have a functional Django environment within Aptana.