analitics

Pages

Friday, August 24, 2012

Python 3.2 : Start with Django 1.4.

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.

Monday, June 25, 2012

Access system version information using python platform module.

The platform module includes the tools to take some infos about operating system, and hardware platform where a program is running.

import platform
dir(platform)

Show all about this module.

Also you can use the help.

help(platform)

Let's try another

print platform.win32_ver()
('', '', '', '')

So is not Windosw OS.

print platform.system()
Linux

Can be 'Linux', 'Windows' or 'Java' ...

print platform.version()

Show you the system's release version ( can be Debian , Ubuntu , Fedora ).

print platform.architecture()
('32bit', 'ELF')
print platform.uname()

Show the infos like uname linux command.

print platform.release()

Show the kernel use by system.

print platform.machine()
i686
print platform.node()

Show the computer's network name.

print platform.linux_distribution()

Show you the linux distribution.