The Definitive Guide to Django

Web Development Done Right

2nd Edition

By Adrian Holovaty , Jacob Kaplan-Moss

Django, the Python-based equivalent to Ruby's Rails web development framework, is one of the hottest topics in web development today. Lead developer Jacob Kaplan-Moss and Django creator Adrian Holovaty show you how they use this framework to create award-winning web sites by guiding you through the creation of a web application.

Full Description

  • ISBN13: 978-1-4302-1936-1
  • User Level: Beginner to Advanced
  • Publication Date: July 7, 2009
  • Available eBook Formats: EPUB, MOBI, PDF
  • Print Book Price: $44.99
  • eBook Price: $31.99
Buy eBook Buy Print Book Add to Wishlist

Related Titles

Full Description

This latest edition of The Definitive Guide to Django is updated for Django 1.1, and, with the forward–compatibility guarantee that Django now provides, should serve as the ultimate tutorial and reference for this popular framework for years to come.

Django, the Python–based equivalent to Ruby’s Rails web development framework, is one of the hottest topics in web development today. Lead developer Jacob Kaplan–Moss and Django creator Adrian Holovaty show you how they use this framework to create award–winning web sites by guiding you through the creation of a web application reminiscent of ChicagoCrime.org.

The Definitive Guide to Django is broken into three parts, with the first introducing Django fundamentals such as installation and configuration, and creating the components that together power a Django–driven web site. The second part delves into the more sophisticated features of Django, including outputting non–HTML content such as RSS feeds and PDFs, caching, and user management. The appendixes serve as a detailed reference to Django’s many configuration options and commands.

What you’ll learn

  • The first half of this book explains in depth how to build web applications using Django including the basics of dynamic web pages, the Django templating system interacting with databases, and web forms.
  • The second half of this book discusses higher-level concepts such as caching, security, and how to deploy Django.
  • The appendixes form a reference for the commands and configurations available in Django.

Who this book is for

Anyone who wants to use the powerful Django framework to build dynamic web sites quickly and easily.

Table of Contents

Table of Contents

  1. Introduction to Django
  2. Getting Started
  3. Views and URLconfs
  4. Templates
  5. Models
  6. The Django Admin Site
  7. Forms
  8. Advanced Views and URLconfs
  9. Advanced Templates
  10. Advanced Models
  11. Generic Views
  12. Deploying Django
  13. Generating Non-HTML Content
  14. Sessions, Users, and Registration
  15. Caching
  16. django.contrib
  17. Middleware
  18. Integrating with Legacy Databases and Applications
  19. Internationalization
  20. Security
Errata

Please Login to submit errata.

On page 133:

class ContactForm(forms.Form):
subject = forms.CharField()
e-mail = forms.EmailField(required=False)
message = forms.CharField()

e-mail is wrong, call it email without the hyphen, otherwise, when importing the form module, python complains

framazz@twilight:~/django/prova$ python manage.py shell
Python 2.7.2+ (default, Nov 30 2011, 19:22:03)
[GCC 4.6.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from contact.forms import ContactForm
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/home/framazz/django/prova/contact/forms.py", line 5
e-mail = forms.EmailField(required=False)
SyntaxError: can't assign to operator

On page 168:

both in view_1 and view_2

return t.render(c) should be
return HttpResponse(t.render(c))

also add
from django.http import HttpResponse on top of the views

On page 169:

def custom_proc(request):
"A context processor that provides 'app', 'user' and 'ip_address'."


should be:
def custom_proc(request):
'''A context processor that provides 'app', 'user' and 'ip_address'. '''
With three quote marks