Book Image

Django 1.0 Website Development

Book Image

Django 1.0 Website Development

Overview of this book

Django is a high-level Python web framework that was developed by a fast-moving online-news operation to meet the stringent twin challenges of newsroom deadlines and the needs of web developers. It is designed to promote rapid development and clean, pragmatic design and lets you build high-performing, elegant web applications rapidly. Django focuses on automating as much as possible and adhering to the DRY (Don't Repeat Yourself) principle, making it easier to build high-performance web applications faster, with less code. This book will show you how to assemble Django's features and take advantage of its power to design, develop, and deploy a fully-featured web site. It will walk you through the creation of an example web application, with lots of code examples. Specially revised for version 1.0 of Django, the book starts by introducing the main design concepts in Django. Next, it leads you through the process of installing Django on your system. After that, you will start right away on building your social bookmarking application using Django. Various Django 1.0 components and sub-frameworks will be explained during this process, and you will learn about them by example. In each chapter, you will build one or more of the features that are essential in Web 2.0 applications, like user management, tags, and AJAX. You will also learn about good software development practices, such as keeping your application secure, and automating testing with unit tests. By the end of the book, you will have built a fully functional real-life Web 2.0 application, and learned how to deploy it to a production server.
Table of Contents (17 chapters)
Django 1.0 Web Site Development
Credits
About the author
About the reviewer
Preface

Why Django?


Since the spread of the MVC pattern into web development, Python has provided quite a few choices when it comes to web frameworks such as Django, TurboGears, and Zope. Although choosing one out of many can be confusing initially, having several competing frameworks can only be a good thing for the Python community. That's because it drives the development of all the frameworks further and provides a rich set of options to choose from.

Django is one of the available frameworks for Python, so the question is: What sets it apart to become the topic of this book, and what makes it popular in the Python community? The next subsections will answer these questions by providing an overview of the main advantages of Django.

Tight integration between components

First of all, Django provides a set of tightly integrated components. All of these components have been developed by the Django team. Django was originally developed as an in-house framework for managing a series of news-oriented web sites. Later, its code was released on the Internet, and the Django team continued its development using the open source model. Because of its roots, Django's components were designed for integration, reusability, and speed from the start.

Object-Relational Mapper

Django's database component, the Object-Relational Mapper (ORM), provides a bridge between the data model and the database engine. It supports a large set of database systems, and switching from one engine to another is a matter of changing a configuration file. This gives the developer great flexibility if a decision is made to change from one database engine to another.

Clean URL design

The URL system in Django is very flexible and powerful. It lets you define patterns for the URLs in your application and define Python functions to handle each pattern. This enables developers to create URLs that are both user and search engine friendly.

Automatic administration interface

Django comes with an administration interface that is ready to be used. This interface makes the management of your application's data a breeze. It is also highly flexible and customizable.

Advanced development environment

In addition, Django provides a very nice development environment. It comes with a lightweight web server for development and testing. When the debugging mode is enabled, Django provides very thorough and detailed error messages with a lot of debugging information. All of this makes isolating and fixing bugs very easy.

Multilingual support

Django supports multilingual web sites through its built-in internationalization system. This can be very valuable for those working on web sites with more than one language. The system makes translating the interface a very simple task.

The standard features expected of a web framework are all available in Django. These include the following:

  • A template and text filtering engine with simple, but extensible syntax

  • A form generation and validation API

  • An extensible authentication system

  • A caching system for speeding up the performance of applications

  • A feed framework for generating RSS feeds

Even though Django does not provide a JavaScript library to simplify working with AJAX, choosing one and integrating it with Django is a straightforward matter, as we will see in later chapters.

So to conclude, Django provides a set of integrated and mature components with excellent documentation at http://www.djangoproject.com/documentation/, thanks to its large community of developers and users. With Django available, there has never been a better time to start learning a web development framework!