Setting up my django environment for Ubuntu

This is how I setup my django development environment on a clean install of Ubuntu.

Moving right along, on a  clean Ubuntu 12.04 install:

  1. Synaptic Package Manager

Once installed open Synaptic Package Manager, find and tick the following programs:

  1. postgresql (9.1 in this case)
    • mark all additional changes
  2. I also check postgresql-server-dev
    • mark all additional changes
  3. Check pgadmin3
    • mark all additional changes
  4. virtualenvwrapper
    • mark all additional changes (make sure python-virtualenv and python-pip are checked)

Now hit Apply and install everything you just marked.

Open your terminal and now you can type:

mkvirtualenv myvenv

You should see this:

mkvirtual

mkvirtual


Now you are able to create your virtualenvironment, install into your virtualenvironment and continue with simple django development such as the django tutorial.

The tutorial uses sqlite but I always develop on postgresql. There are some steps to getting postgresql setup on your environment. You can easily do that by following How to install and setup postgresql on Ubuntu.

Now that your postgresql is configured to be able to use postgresql with django you have to install psycopg2. We have to

pip install psycopg2

but if you do that now you’ll probably land up with this compile error

error: command ‘gcc’ failed with exit status 1

Fix it by following Installing psycopg2 in Ubuntu in a virtualenvironment

Now you could go and already start creating and developing django projects that also offer database support.  Somewhere down the line though you are going to probably need to use Python Imaging Library aka PIL. This is nortorious for giving installation problems. Try

pip install pil

. You should see a lot of compiling going on. The message that gets reported is

Successfully installed pil
Cleaning up…

Seems all went well? Not really, if you look up you will see

——————————————————————–
PIL 1.1.7 SETUP SUMMARY
——————————————————————–
version 1.1.7
platform linux2 2.7.3 (default, Apr 20 2012, 22:44:07)
[GCC 4.6.3]
——————————————————————–
*** TKINTER support not available
*** JPEG support not available
*** ZLIB (PNG/ZIP) support not available
*** FREETYPE2 support not available
*** LITTLECMS support not available
——————————————————————–

Support not available for all the items??? wtf?
Fix this by Installing PIL into a virtualenv properly in Ubuntu

In summary you:

  1. Install virutalenvironment and other needed items
  2. Setup postgresql and pgadmin3
  3. Setup PIL for proper support

Now you are ready to develop as you wish using the django platform.

*optional next steps

SSH keys for GIT and HEROKU

About these ads

One thought on “Setting up my django environment for Ubuntu

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s