Friday, August 24, 2012

python 3.2 and django 1.4 - installation

Although most of us prefer the python version 2.6, today I tried to install the latest version of django and python 2.3.2 .

Make a new folder , named test-dj .

$mkdir test-dj
$cd test-dj/

On the official site, I got the two archives:

django-django-1.4-919-ge57338f.zip
Python-3.2.3.tar.bz2

I will start with the installation of python. We unzip the archive:

$tar xvjf Python-3.2.3.tar.bz2 

We execute the following commands to install python:

$cd Python-3.2.3
$./configure
$make all
$sudo make altinstall
# python3.2 setup.py install 

Let's see what we have.

$ whereis  python3
python3: /usr/lib/python3.0 /usr/local/bin/python3.2m-config
/usr/local/bin/python3.2 /usr/local/bin/python3.2m 
/usr/local/lib/python3.2

As you see it's ...

python3.2
python3.2m
python3.2m-config

In accordance with the PEP-3149 we can got this:

Python implementations MAY include additional flags in the file name tag as appropriate. For example, on POSIX systems these flags will also contribute to the file name:

        * --with-pydebug (flag: d)
        * --with-pymalloc (flag: m)
        * --with-wide-unicode (flag: u)

Now we need to install django.

$unzip django-django-1.4-919-ge57338f.zip

Go to the django folder:

$cd django-django-e57338f/
# python3.2 setup.py install 

Now , we can test it:

# python3.2
Python 3.2.3 (default, Aug 24 2012, 19:24:21) 
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import django 
>>> print(django.get_version())
1.5
>>> 

I will make another tutorial about how to configure the django to have one website.