Learning Website Development with Django

There is a newer version of this book available - Django 1.0 Website Development
Learning Website Development with Django
eBook: $23.99
Formats: PDF, PacktLib, ePub and Mobi formats
save 35%!
Print + free eBook + free PacktLib access to the book: $63.98    Print cover: $39.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Table of Contents
Sample Chapters
  • Create a complete Web 2.0-style web application with Django
  • Learn rapid development and clean, pragmatic design
  • Build a social bookmarking application
  • No knowledge of Django required

Book Details

Language : English
Paperback : 264 pages [ 235mm x 191mm ]
Release Date : April 2008
ISBN : 1847193358
ISBN 13 : 9781847193353
Author(s) : Ayman Hourieh
Topics and Technologies : All Books, Web Development, Architecture & Analysis, Content Management (CMS), Open Source


Table of Contents

Chapter 1: Introduction to Django
Chapter 2: Getting Started
Chapter 3: Building a Social Bookmarking Application
Chapter 4: User Registration and Management
Chapter 5: Introducing Tags
Chapter 6: Enhancing the User Interface with Ajax
Chapter 7: Voting and Commenting
Chapter 8: Creating an Administration Interface
Chapter 9: Advanced Browsing and Searching
Chapter 10: Building User Networks
Chapter 11: Extending and Deploying
Chapter 12: What Next?
  • Chapter 1: Introduction to Django
    • The MVC Pattern in Web Development
    • Why Python?
    • Why Django?
      • Tight Integration between Components
      • Object-Relational Mapper
      • Clean URL Design
      • Automatic Administration Interface
      • Advanced Development Environment
      • Multi-Lingual Support
    • History of Django
    • Summary
  • Chapter 2: Getting Started
    • Installing the Required Software
      • Installing Python
        • Installing Python on Windows
        • Installing Python on UNIX/Linux
        • Installing Python on Mac OS X
      • Installing Django
        • Installing Django on Windows
        • Installing Django on UNIX/Linux and Mac OS X
      • Installing a Database System
    • Creating Your First Project
      • Creating an Empty Project
      • Setting up the Database
      • Launching the Development Server
    • Summary
  • Chapter 3: Building a Social Bookmarking Application
    • A Word about Django Terminology
    • URLs and Views: Creating the Main Page
      • Creating the Main Page View
      • Creating the Main Page URL
    • Models: Designing an Initial Database Schema
      • The Link Data Model
      • The User Data Model
      • The Bookmark Data Model
    • Templates: Creating a Template for the Main Page
    • Putting It All Together: Generating User Pages
      • Creating the URL
      • Writing the View
      • Designing the Template
      • Populating the Model with Data
    • Summary
  • Chapter 4: User Registration and Management
    • Session Authentication
      • Creating the Login Page
      • Enabling Logout Functionality
    • Improving Template Structure
    • User Registration
      • Django Forms
      • Designing the User Registration Form
    • Account Management
    • Summary
  • Chapter 5: Introducing Tags
    • The Tag Data Model
    • Creating the Bookmark Submission Form
      • Restricting Access to Logged-in Users
      • Methods for Browsing Bookmarks
      • Improving the User Page
      • Creating a Tag Page
      • Building a Tag Cloud
    • A Word on Security
      • SQL Injection
      • Cross-Site Scripting (XSS)
    • Summary
  • Chapter 6: Enhancing the User Interface with Ajax
    • Ajax and Its Advantages
    • Using an Ajax Framework in Django
      • Downloading and Installing jQuery
    • The jQuery JavaScript Framework
      • Element Selectors
      • jQuery Methods
        • Hiding and Showing Elements
        • Accessing CSS Properties and HTML Attributes
        • Manipulating HTML Documents
        • Traversing the Document Tree
        • Handling Events
        • Sending Ajax Requests
        • What Next?
    • Implementing Live Searching of Bookmarks
      • Implementing Searching
      • Implementing Live Searching
    • Editing Bookmarks in Place
      • Implementing Bookmark Editing
      • Implementing In-Place Editing of Bookmarks
    • Auto-Completion of Tags
    • Summary
  • Chapter 7: Voting and Commenting
    • Sharing Bookmarks on the Main Page
      • The SharedBookmark Data Model
      • Modifying the Bookmark Submission Form
      • Browsing and Voting for Shared Bookmarks
      • The Popular Bookmarks Page
    • Commenting on Bookmarks
      • Enabling the Comments Application
      • Creating a View for Comments
      • Displaying Comments and a Comment Form
      • Creating Comment Templates
    • Summary
  • Chapter 8: Creating an Administration Interface
    • Activating the Administration Interface
    • Customizing the Administration Interface
      • Customizing Listing Pages
      • Overriding Administration Templates
    • Users, Groups and Permissions
      • User Permissions
      • Group Permissions
      • Using Permissions in Views
    • Summary
  • Chapter 9: Advanced Browsing and Searching
    • Adding RSS Feeds
      • Creating the Recent Bookmarks Feed
        • Customizing Item Fields
      • Creating the User Bookmarks Feed
      • Linking Feeds to HTML Pages
    • Advanced Searching
      • Retrieving Objects with the Database API
      • Advanced Queries with Q Objects
      • Improving the Search Feature
    • Organizing Content into Pages (Pagination)
    • Summary
  • Chapter 10: Building User Networks
    • Building Friend Networks
      • Creating the Friendship Data Model
      • Writing Views to Manage Friends
        • The Friends List View
        • Creating the "Add Friend" View
    • Inviting Friends Via Email
      • The Invitation Data Model
      • The "Invite a Friend" Form and View
      • Handling Activation Links
    • Improving the Interface with Messages
    • Summary
  • Chapter 11: Extending and Deploying
    • Internationalization (i18n)
      • Marking Strings as Translatable
      • Creating Translation Files
      • Enabling and Configuring the i18n System
    • Improving Performance with Caching
      • Enabling Caching
        • Simple Caching
        • Database Caching
        • File System Caching
        • Memcached
      • Configuring Caching
        • Caching the Whole Site
        • Caching Specific Views
    • Unit Testing
      • The Test Client
      • Testing the Registration View
      • Testing the "Save Bookmark" View
    • Deploying Django
      • The Production Web Server
      • The Production Database
      • Turning Off Debug Mode
      • Changing Configuration Variables
      • Setting Error Pages
    • Summary
  • Chapter 12: What Next?
    • Custom Template Tags and Filters
    • Model Managers and Custom SQL
    • Generic Views
    • Contributed Sub-Frameworks
      • Flatpages
      • Sites
      • Markup Filters
      • Humanize
      • Sitemaps
      • Cross-site Request Forgery Protection
    • Message System
    • Subscription System
    • User Scores
    • Summary

Ayman Hourieh

Ayman Hourieh holds a bachelor degree in Computer Science. He joined the engineering team at Google in January 2008. Prior to that, he worked with web application development for more than two years. In addition, he has been contributing to several Open Source projects such as Mozilla Firefox. Ayman also worked as a teaching assistant in Computer Science courses for one year. Even after working with a variety of technologies, Python remains Ayman's favorite programming language. He found Django to be a powerful and flexible Python framework that helps developers to produce high-quality web applications in a short time.

Code Downloads

Download the code and support files for this book.

Submit Errata

Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


- 5 submitted: last submission 30 Oct 2013

Errata type: Code | Page number: 33

title=models.CharField(maxlength=200) maxlength should be max_length

Errata type: Code | Page number: 46

{% if form.has_errors %} should be {% if form.errors %}

Errata type: URL change | Page number: 123

jQuery plugin site address is listed as http://docs.jquery.com/Plugins
It should be

Errata type: Typo | Page number: 58

In the second to last paragraph, the form.clean_data reference should be form.cleaned_data

Errata type: Typo | Page number: 71

At point 6, the constructor and destructor functions must be called Example25FrameListener() and ~Example25FrameListener() respectively.

Sample chapters

You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

Frequently bought together

Learning Website Development with Django +    Zabbix 1.8 Network Monitoring =
50% Off
the second eBook
Price for both: €27.35

Buy both these recommended eBooks together and get 50% off the cheapest eBook.

What you will learn from this book

  • User registration and management
  • Dealing with content customization and searching
  • Working with the tag data model
  • Creating your own administration interface
  • Using AJAX to enhance the user interface
  • Building user networks
  • Setting up and deploying Django applications on the production web server

Chapter 1 gives you an introduction to MVC web development frameworks, a history of Django, and explains why Python and Django are the best tools to use to achieve the aim of this book.

Chapter 2 provides a step-by-step guide to installing Python, Django, and an appropriate database system so that you can create an empty project and set up the development server.

Chapter 3 creates the main page so that we have the initial view and a URL. You will learn how to create templates for both the main page and the user page.

Chapter 4 is where the application really starts to take shape as user management is implemented. Learn how to log users in and out, create a registration form and allow users to manage their own accounts by changing email or password details.

Chapter 5 explores how to manage your growing bank of content. Create tags, tag clouds, and a bookmark submission form all of which interact with your database. Security features also come into play as you learn how to restrict access to certain pages and protect against malicious input.

Chapter 6 enables you to enhance your application with AJAX and jQuery as users can now edit entries in place and do live searching. Data entry is also made easier with the introduction of auto-completion.

Chapter 7 shows you how to enable users to vote and comment on their bookmark entries.

Chapter 8 focuses on the administration interface. You will learn how to create and customize the interface, which allows you to manage content and to set permissions for users and groups.

Chapter 9 will give your application a much more professional feel through the implementation of RSS feeds and pagination.

Chapter 10 tackles social networks providing the 'social' element of your application. Users will be able to build a friend network, browse the bookmarks of their friends, and invite their friends to join the website.

Chapter 11 covers extending and deploying your application. You will also learn about advanced features including offering the site in multiple languages, managing the site during high traffic, and configuring the site for a production environment.

Chapter 12 takes a brief look at extra Django features that have not been covered elsewhere in the book. You will gain the knowledge required to further your application and build on the basic skills that you have learned throughout the book.

In Detail

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 leverage its power to design, develop, and deploy a fully-featured website. It will walk you through the creation of an example web application, with lots of code. Each chapter will add new features to the site, and show what parts of Django to work on to build these features.

This book has been specifically written for Python developers new to Django, and it's goal is to help you put together Django applications as quickly as possible. This book will give you clear, concise and, of course, practical guidance to take you from the basics of creating pages with Django through to learning the skills that will make you a Django developer to be reckoned with.

This book is a beginner's guide to design, develop, and deploy a fully-featured dynamic website using the features of Django.


Being a beginner's guide this book has a very simple and clear approach. It is a practical guide that will help you learn the features of Django and help you build a dynamic website using those features.

Who this book is for

This book is for web developers who want to see how to build a complete site with Web 2.0 features, using the power of a proven and popular development system, but do not necessarily want to learn how a complete framework functions in order to do this.

Basic knowledge of Python development is required for this book, but no knowledge of Django is expected.

Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software