Book Image

Instant Django 1.5 Application Development Starter

By : Mauro Rocco
Book Image

Instant Django 1.5 Application Development Starter

By: Mauro Rocco

Overview of this book

<p>Django is a high-level Python application framework built for development speed and accuracy. With a flatter learning curve than most frameworks, Django quickly enables you to create elegant, performant applications.<br /><br />In this book you will jump into Django by creating a web application step by step. Offering you a quick but comprehensive immersion into the world of Python development, Instant Django 1.5 Application Development Starter begins with a practical exploration of the framework’s powerful mechanisms and tools and finishes your journey by taking you through the creation of one sample application.<br /><br />In "Instant Django 1.5 Application Development Starter" you will learn how Django’s components work together. You will get familiar with the powerful template system, and will discover how easy it is to generate a web administration interface for your project. You will learn how to work with user authentication, forms, and session management.<br /><br />Through this book you will learn everything you need to know to create stunning web applications in a very short time, taking advantage of all the beauty and power that Python has to offer. If you want to start building serious web applications using Python, this book is all you need.</p>
Table of Contents (7 chapters)

Installation


Installing Django on your system is very easy. As it is just Python, you will only need a small effort to get it up and running on your machine. We will do it in two easy steps:

Step 1 – What do I need?

The only thing you need on your system to get Django running is obviously Python. At the time of writing this book, the latest version available is the 1.5c1 (release candidate) and it works on all Python versions from 2.6.5 to 2.7, and it also features experimental support for Version 3.2 and Version 3.3.

Get the right Python package for your system at http://www.python.org. If you are running Linux or Mac OSX, Python is probably already installed in your operating system.

Note

If you are using Windows you will need to add the path of the Python installation folder (C:\Python27) to the environment variables.

You can verify that Python is installed by typing python in your shell. The expected result should look similar to the following output:

Python 2.7.2 (default, Jun 20 2012, 16:23:33)
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>

Step 2 – Get and install Django

Now we will see two methods to install Django: through a Python package manager tool called pip and the manual way. Feel free to use the one that you prefer.

Note

At the time of writing this book the Django Version 1.5 is in the release candidate status, if this is still the case jump to the manual installation step and download the 1.5 release candidate package in place of the last stable one.

Installing Django with pip

Install pip; the easiest way is to get the installer from http://www.pip-installer.org:

  • If you are using a Unix OS execute the following command:

    $ sudo pip install Django 
    
  • If you are using Windows you will need to start a shell with administrator privileges and run the following command:

    $ pip install Django
    

Installing Django manually

  1. Download the last stable release from the official Django website https://www.djangoproject.com/download/.

  2. Uncompress the downloaded file using the tool that you prefer.

  3. Change to the directory just created (cd Django-X.Y).

  4. If you are using a Unix OS execute the following command:

    $ sudo python setup.py install
    
  5. If you are using Windows you will need to start a shell with administrator privileges and run the command:

    $ python setup.py install Django
    

Verifying the Django installation

To verify that Django is installed on your system you just need to open a shell and launch a Python console by typing python.

In the Python console try to import Django:

>>> import django
>>> django.get_version()
'1.5' c1

And that's it!!

Now that Django is installed on your system we can start to explore all its potential.