Table of Content
Introduction
- What Is a Web Framework?
- MVC
- Django Evolution
- Getting Help
Getting Started
- Installation
- Database Setup
- Starting a Project
The Basics of Dynamic Web Pages
- Your First View: Dynamic Content
- Mapping URLs to Views
- How Django Processes a Request
- URLconfs and Loose Coupling
- 404 Errors
- Your Second View: Dynamic URLs
- Django’s Pretty Error Pages
The Django Template System
- Template System Basics
- Using the Template System
- Basic Template Tags and Filters
- Philosophies and Limitations
- Using Templates in Views
- Template Inheritance
Interacting with a Database: Models
- The “Dumb†Way to Do Database Queries in Views
- The MTV Development Pattern
- Configuring the Database
- Your First App
- Defining Models in Python
- Your First Model
- Installing the Model
- Basic Data Access
- Inserting and Updating Data
- Selecting Objects
- Making Changes to a Database Schema
The Django Administration Site
- Activating the Admin Interface
- Using the Admin Interface
- Customizing the Admin Interface
- Customizing the Admin Interface’s Look and Feel
- When and Why to Use the Admin Interface
Form Processing
- Search
- The “Perfect Formâ€
- Processing the Submission
- Custom Validation Rules
- A Custom Look and Feel
- Creating Forms from Models
Advanced Views and URLconfs
- URLconf Tricks
- Including Other URLconfs
Generic Views
- Using Generic Views
- Generic Views of Objects
- Extending Generic Views
Extending the Template Engine
- Template Language Review
- RequestContext and Context Processors
- Inside Template Loading
- Extending the Template System
- Writing Custom Template Loaders
- Using the Built-in Template Reference
- Configuring the Template System in Standalone Mode
Generating Non-HTML Content
- The basics: views and MIME-types
- Producing CSV
- Generating PDFs
- Other Possibilities
- The Syndication Feed Framework
- The Sitemap Framework
Sessions, Users, and Registration
- Cookies
- Django’s Session Framework
- Users and Authentication
- The Other Bits: Permissions, Groups, Messages, and Profiles
Caching
- Setting Up the Cache
- The Per-Site Cache
- The Per-View Cache
- The Low-Level Cache API
- Upstream Caches
- Other Optimizations
- Order of MIDDLEWARE_CLASSES
Other Contributed Subframeworks
- The Django Standard Library
- Sites
- Flatpages
- Redirects
- CSRF Protection
- Humanizing Data
- Markup Filters
Middleware
- What’s Middleware?
- Middleware Installation
- Middleware Methods
- Built-in Middleware
Integrating with Legacy Databases and Applications
- Integrating with a Legacy Database
- Integrating with an Authentication System
- Integrating with Legacy Web Applications
Extending Django’s Admin Interface
- The Zen of Admin
- Customizing Admin Templates
- Creating Custom Admin Views
- Overriding Built-in Views
Internationalization
- Specifying Translation Strings in Python Code
- Specifying Translation Strings in Template Code
- Creating Language Files
- How Django Discovers Language Preference
- The set_language Redirect View
- Using Translations in Your Own Projects
- Translations and JavaScript
Security
- The Theme of Web Security
- SQL Injection
- Cross-Site Scripting (XSS)
- Cross-Site Request Forgery
- Session Forging/Hijacking
- Email Header Injection
- Directory Traversal
- Exposed Error Messages
- A Final Word on Security
Deploying Django
- Shared Nothing
- A Note on Personal Preferences
- Using Django with Apache and mod_python
- Using Django with FastCGI
- Scaling
- Performance Tuning