Django [how to] : Meet Django Part 1 – Introduction

Django. Wait, What?

Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.

Developed by a fast-moving online-news operation, Django was designed to handle two challenges: the intensive deadlines of a newsroom and the stringent requirements of the experienced Web developers who wrote it. It lets you build high-performing, elegant Web applications quickly.

Yes i love django in the first sight. Even i’m new to python, django (and python of course)  it’s so easy, just like the “algorithm”. My background in web dev, is using PHP more than 3years, but only in a few month, i can fully develop some app with python (and django). If i have to create similar app like that in PHP, maybe it took more time, maybe twice, than using Python (and django of course).

Django features

From their webpage (django web page) these are the features :

  • Object-relational mapper
    Define your data models entirely in Python. You get a rich, dynamic database-access API for free — but you can still write SQL if needed.
  • Automatic admin interface
    Save yourself the tedious work of creating interfaces for people to add and update content. Django does that automatically, and it’s production-ready.
  • Elegant URL design
    Design pretty, cruft-free URLs with no framework-specific limitations. Be as flexible as you like.
  • Template system
    Use Django’s powerful, extensible and designer-friendly template language to separate design, content and Python code.
  • Cache system
    Hook into memcached or other cache frameworks for super performance — caching is as granular as you need.
  • Internationalization
    Django has full support for multi-language applications, letting you specify translation strings and providing hooks for language-specific functionality.

Show me the way :

I assume You use some linux distribution and familiar with console, if not, just try to adopt it, and feel free to ask me :D. In my example, I’m using ubuntu 10.04 (x86).

So, open your terminal, in ubuntu just press ALT + F2 and type gnome-terminal and click Run / Enter, it will open the console, and make sure to change your user to root.

Make sure you have python setuptools, or if not, install with this command :

Using easy_install :

sudo apt-get install python-setuptools
easy_install django

Using pip :

sudo apt-get install python-setuptools
easy_install django

Now try your django installation is working using this command :

root@fajri-laptop:/home/fajri# python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> django.get_version()
'1.4'

Alternate Installation (from django page) :

Option 1. Get the latest official version

The latest official version is 1.4. Here’s how to get it:

First, download Django-1.4.tar.gz (checksums, release notes). Then:

tar xzvf Django-1.4.tar.gz cd Django-1.4
sudo python setup.py install

Option 2. Get the latest development version

The latest and greatest Django version is the one that’s in our Git repository (our revision-control system). Get it using this shell command, which requires Git:

git clone https://github.com/django/django.git

You can also download a zipped archive of the development version.

Using pip / easy_install or python setup.py install is give the same result like this :

In next post, we’ll playing django and create some project & apps. Feel free to ask me 😀

Conclusion :

  1. Django (and Python) is easy 🙂
  2. There is two ways to install some python package, first using pip / easy_install. Second, using python setup.py install
  3. To make sure our package is installed, use command : import packageName (ie : import django) if there’s no error message, then our package is installed.
Advertisements

One thought on “Django [how to] : Meet Django Part 1 – Introduction

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