Python Web Development with Django

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Using the simple, robust, Python-based Django framework, you can build powerful Web solutions with remarkably few lines of code. In Python Web Development with Django(R), three experienced Django and Python developers cover all the techniques, tools, and concepts you need to make the most of Django 1.0, including all the major features of the new release. The authors teach Django through in-depth explanations, plus provide extensive sample code supported with images and line-by-line explanations. You'll discover how Django leverages Python's development speed and flexibility to help you solve a wide spectrum of Web development problems and learn Django best practices covered nowhere else. You'll build your first Django application in just minutes and deepen your real-world skills through start-to-finish application projects including Simple Web log (blog) Online photo gallery Simple content management system Ajax-powered live blogger Online source code sharing/syntax highlighting tool How to run your Django applications on the Google App Engine This complete guide starts by introducing Python, Django, and Web development concepts, then dives into the Django framework, providing a deep understanding of its major components (models, views, templates), and how they come together to form complete Web applications. After a discussion of four independent working Django applications, coverage turns to advanced topics, such as caching, extending the template system, syndication, admin customization, and testing. Valuable reference appendices cover using the command-line, installing and configuring Django, development tools, exploring existing Django applications, the Google App Engine, and how to get more involved with the Django community. Introduction 1 Part I: Getting Started Chapter 1: Practical Python for Django 7 Chapter 2: Django for the Impatient: Building a Blog 57 Chapter 3: Starting Out 77 Part II: Django in Depth Chapter 4: Defining and Using Models 89 Chapter 5: URLs, HTTP Mechanisms, and Views 117 Chapter 6: Templates and Form Processing 135 Part III: Django Applications by Example Chapter 7: Photo Gallery 159 Chapter 8: Content Management System 181 Chapter 9: Liveblog 205 Chapter 10: Pastebin 221 Part IV: Advanced Django Techniques and Features Chapter 11: Advanced Django Programming 235 Chapter 12: Advanced Django Deployment 261 Part V: Appendices Appendix A: Command Line Basics 285 Appendix B: Installing and Running Django 295 Appendix C: Tools for Practical Django Development 313 Appendix D: Finding, Evaluating, and Using Django Applications 321 Appendix E: Django on the Google App Engine 325 Appendix F: Getting Involved in the Django Project 337 Index 339 Colophon 375

Author(s): Jeff Forcier; Wesley J. Chun
Publisher: Addison-Wesley Professional
Year: 2008

Language: English
Pages: 377

Table of Contents
Introduction
Where Web Frameworks Come From
A Better Way
We’re Not in Kansas Anymore
Web Development Is Better with Python and Django
I: Getting Started
1 Practical Python for Django
Python Skills Are Django Skills
Getting Started: Python’s Interactive Interpreter
Python Basics
Python Standard Types
Flow Control
Exception Handling
Files
Functions
Object-Oriented Programming
Regular Expressions
Common Gotchas
Coding Style (PEP 8 and Beyond)
Summary
2 Django for the Impatient: Building a Blog
Creating the Project
Running the Development Server
Creating the Blog Application
Designing Your Model
Setting Up the Database
Setting Up the Automatic admin Application
Trying Out the admin
Making Your Blog’s Public Side
Finishing Touches
Summary
3 Starting Out
Dynamic Web Site Basics
Understanding Models, Views, and Templates
Overall Django Architecture
Core Philosophies of Django
Summary
II: Django in Depth
4 Defining and Using Models
Defining Models
Using Models
Summary
5 URLs, HTTP Mechanisms, and Views
URLs
Modeling HTTP: Requests, Responses, and Middleware
Views/Logic
Summary
6 Templates and Form Processing
Templates
Forms
Summary
III: Django Applications by Example
7 Photo Gallery
The Model
Preparing for File Uploads
Installing PIL
Testing ImageField
Building Our Custom File Field
Using ThumbnailImageField
Setting Up DRY URLs
The Item App’s URL Layout
Tying It All Together with Templates
Summary
8 Content Management System
What’s a CMS?
The Un-CMS: Flatpages
Beyond Flatpages: A Simple Custom CMS
Possible Enhancements
Summary
9 Liveblog
What Exactly Is Ajax?
Planning the Application
Laying Out the Application
Putting the Ajax In
Summary
10 Pastebin
Defining the Model
Creating the Templates
Designing the URLs
Trying It Out
Limiting Number of Recent Pastes Displayed
Syntax Highlighting
Cleanup Via Cron Job
Summary
IV: Advanced Django Techniques and Features
11 Advanced Django Programming
Customizing the Admin
Using Syndication
Generating Downloadable Files
Enhancing Django’s ORM with Custom Managers
Extending the Template System
Summary
12 Advanced Django Deployment
Writing Utility Scripts
Customizing the Django Codebase Itself
Caching
Testing Django Applications
Summary
V: Appendices
A: Command Line Basics
Putting the “Command” in “Command Line”
Options and Arguments
Pipes and Redirection
Environment Variables
The Path
Summary
B: Installing and Running Django
Python
Django
Web Server
SQL Database
Summary
C: Tools for Practical Django Development
Version Control
Project Management Software
Text Editors
D: Finding, Evaluating, and Using Django Applications
Where to Look for Applications
How to Evaluate Applications
How to Use Applications
Sharing Your Own Application
E: Django on the Google App Engine
Why the App Engine Matters
Pure Google App Engine Applications
Limitations of the App Engine Framework
Google App Engine Helper for Django
Integrating the App Engine
Creating a New Django Application That Runs on App Engine
Summary
Online Resources
F: Getting Involved in the Django Project
Index
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X–Z
Colophon