Home     |      Learn AJAX     |      Forum     |      Register     |      Submit Resource     |      Submit Article      |      Contact Us

Home Frameworks
 

Introduction to Django

 

Introduction to Django

Page 1 of 2

Introduction to Django


Welcome! In this book, you will learn about Django, an Open Source web framework that enables you to build clean and feature-rich web applications with minimal time and effort. Django is written in Python, a general purpose language that is well suited for developing web applications. Django loosely follows a model-viewcontroller design pattern, which greatly helps in building clean and maintainable web applications.


This chapter gives you an overview of the technologies used in this book. The following chapters will take you through a tutorial for building a social bookmarking application from the group using Django.


In this introduction, you will read about the following:


  • The MVC pattern in web development.
  • Why we should use Python.
  • Why we should use Django.
  • The history of Django.

The MVC Pattern in Web Development


Web development has made great progress during the last few years. It began as a tedious task that involved using CGI for interfacing external programs with the web server. CGI applications used standard I/O facilities available to the C programming language in order to manually parse user input and produce page output. In addition to being difficult to work with, CGI required a separate copy of the program to be launched for each request, which used to quickly overwhelm servers.


Next, scripting languages were introduced to web development, and this inspired developers to create more efficient technologies. Languages such as Perl and PHP quickly made their way into the world of web development, and as a result, common web tasks such as cookie handling, session management, and text processing became much easier. Although scripting languages included libraries to deal with day-to-day web-related tasks, they lacked unified frameworks, as libraries were usually disparate in design, usage, and conventions. Therefore, the need for cohesive frameworks arose.


A few years ago, the model-view-controller pattern came for web-based applications was introduced. This software engineering pattern separates data (model), user interface (view), and data handling logic (controller), so that one can be changed without affecting the others. The benefits of this pattern are obvious. With it, designers can work on the interface without worrying about data storage or management. And developers are able to program the logic of data handling without getting into the details of presentation. As a result, the MVC pattern quickly found its way into web languages, and serious web developers started to embrace it in preference to previous techniques.


The diagram below shows how each of the components of the MVC pattern interact with each other to serve a user request:



Why Python?


Python is a general purpose programming language. Although it is used for a wide variety of applications, Python is very suitable for developing web applications. It has a clean and elegant syntax, and is supported by a large library of standard and contributed modules, which covers everything from multi-threading to the zipping of files. The language's object-oriented model is especially suited for MVC style development.


Sooner or later, performance will become a major concern with web projects, and Python's runtime environment shines here, as it is known to be fast and stable. Python supports a wide range of web servers through modules, including the infamous Apache. Furthermore, it is available for all the major platforms: UNIX/ Linux, Windows, and Mac. Python also supports a wide array of database servers, but you won't have to deal directly with them; Django provides a unified layer of access to all available database engines, as we will see later.


Python is free software; you can download and use it freely from http://www.python.org/. You are even allowed to distribute it without having to pay any fees. Access to the source code is available to those who want to add features or fix bugs. As a result, Python enjoys a large community of developers who quickly fix bugs and introduce new features.


Python is very easy to learn, and it is being adopted in many universities as the first programming language to be taught. Although this book assumes working knowledge of Python, advanced features will be explained as they are used. If you want to refresh your Python knowledge, you are recommended to read the official Python tutorial available at http://www.python.org/doc/ before continuing with this book.


To sum up, Python was chosen over many other scripting languages for this book for the following reasons:


  • Clean and elegant syntax.
  • Large standard library of modules that covers a wide range of tasks.
  • Extensive documentation.
  • Mature runtime environment.
  • Support for standard and proven technologies such as Linux and Apache.


NOTE: If you want to learn more about Python and its features, the official Python website at http://www.python.org/ and the Python book "Dive Into Python" (freely available at http://www.diveintopython.org/ ) are both excellent sources.


Next Page: Why Django


Read Next: AFLAX - A Lightweight Ajax Framework with Flash



 

 

Comments



Post Your Comment:

Members Please Login
Your Name:*
e-mail ID:(required for notification)*
Image Verification: 
 
 Subscribe    

Sponsored Links