Python Web Development with Django
Download
Introduction
Welcome to Django!
Greetings, and welcome to Django! We’re glad to have you along on our journey.You
will discover a powerful Web application framework that lets you do everything
rapidly—from designing and developing the original application to updating its features
and functionality without requiring major changes to the codebase.
About This Book
Several Django books are already on the market, but ours differs from most in that we
focus equally on three areas: Django basics, a variety of example applications, and
advanced Django topics. Our intent is to make this the most well-rounded book on the
subject, one you find useful regardless of background, and which will give you a complete
picture of the framework and what you can do with it.
Chapter Guide
In Figure 0.1, you see recommended starting points for your reading depending on your
Python and Django experience. Of course, we recommend a cover-to-cover treatment,
but the diagram will help if time is not on your side. Regardless of your experience, you
are always welcome to look at the applications because reading and studying code is one
of the best ways to learn.We also provide this chapter-by-chapter reading guide to
further help direct you to where you need to read.
Part I, “Getting Started”
Part I covers the basic material needed to introduce users new to Django and/or
Python, although we recommend Chapter 3,“Starting Out,” even to advanced readers.
Chapter 1, “Practical Python for Django”
This chapter is an introduction for readers who are new to Python. In one comprehensive
chapter, we show you not only the syntax, but also go a bit more in-depth and
expose you to Python’s memory model and data types, especially constructs commonly
used in Django.
Chapter 2, “Django for the Impatient: Building a Blog”
This is a chapter for those who want to skip any Python introduction and want to dive
immediately into a Django application that can be completed in 15-20 minutes. It gives
a good overview of what’s possible with the framework.
Chapter 3, “Starting Out”
For those with a bit more patience, this chapter serves as an introduction to all the foundations
of developing Web-based applications (useful both for newbies and experienced coders alike). Once the formalities are over, we describe how each concept fits into the
world of Django as well as what its philosophies are and how it may differ from other
Web application frameworks.
Part II, “Django in Depth”
Part II covers all the basic components of the framework, laying the foundation for the
example applications in Part III,“Django Applications by Example.”
Chapter 4, “Defining and Using Models”
In Chapter 4, learn how to define and work with your data model, including the basics
of Django’s object-relational mapper (ORM) from simple fields up to complex relations.
Chapter 5, “URLs, HTTP Mechanisms, and Views”
This chapter goes into detail on how Django handles URL processing and the rest of
the HTTP protocol, including middleware layers, as well as how to use Django’s timesaving
generic views, and how to write custom or partially custom views from scratch.
Chapter 6, “Templates and Form Processing”
Chapter 6 covers the final major piece of the framework, where we explore Django’s
template language and its form-handling mechanisms. It covers how to display data to
your users and get data back from them.
Part III, “Django Applications by Example”
In Part III, we create four distinct applications, each highlighting a different aspect or
component of Django development, both to introduce new general ideas and to expand
on the concepts found in Parts I and II.
Chapter 7, “Photo Gallery”
In Chapter 7, learn how to apply the “Don’t Repeat Yourself” convention to your URL
structure and create a new thumbnail-creating image form field, while you make a simple
photo gallery application.
Chapter 8, “Content Management System”
Chapter 8 contains two related approaches to creating a CMS or CMS-like system and
covers the use of a number of “contrib” Django applications.
Chapter 9, “Liveblog”
Chapter 9 covers writing a “liveblog”—a site that makes use of advanced JavaScript
techniques, serves as a backdrop for applying AJAX to a Django project, and shows how
easy it is to use any AJAX toolkit you want.
Chapter 10, “Pastebin”
In Chapter 10, learn the power of Django’s generic views as we create a pastebin using
almost no custom logic whatsoever.
Part IV, “Advanced Django Techniques and Features”
Part IV is a collection of advanced topics, ranging from customizing Django’s admin
application to writing command-line scripts that interface with your Django applications.
Chapter 11, “Advanced Django Programming”
Chapter 11 covers a number of topics related to fleshing out your own application’s
code, such as RSS generation, extending the template language, or making better use of
the Django admin application.
Chapter 12, “Advanced Django Deployment”
In Chapter 12, learn a number of tricks related to deploying Django applications or
working with your app from outside your Django project’s core code, such as commandline
scripts, cron jobs, testing, or data import.
Part V, “Appendices”
Part V fills in the remaining gaps or addresses topics relevant to the rest of the book but
that don’t fit in well as full chapters. Learn the basics of the Unix command line, Django
installation and deployment strategies, tools for development, and more.
Appendix A, “Command Line Basics”
Appendix A is an introduction to the Unix command line for those who haven’t been
exposed to it before now.Trust us—it’s useful!
Appendix B, “Installing and Running Django”
In Appendix B, learn how to install all the necessary components for running Django,
including the various options for database and Web servers, as well as some tips on specific
deployment strategies.
Appendix C, “ Tools for Practical Django Development”
Appendix C outlines some basic development tools you may or may not be familiar
with, including source control, text editors, and more.
Appendix D, “Finding, Evaluating, and Using Django Applications”
Good developers write code, but great developers reuse somebody else’s code! In
Appendix D, we share some tips on the where and how of finding reusable Django
applications.
Appendix E, “Django on the Google App Engine”
Appendix E provides an exclusive look at how Google’s new App Engine leverages
Django, and you can also learn how to enable your Django applications to run under the
App Engine framework.
Appendix F, “Getting Involved in the Django Project”
In Appendix F, learn how to contribute to Django and become a part of the community
Home Web Development Python Web Development with Django