فهرست مطالب :
Dedication
About the Dedication
Forward by William Vincent
Authors' Notes
A Few Words From Daniel Feldroy
A Few Words From Audrey Feldroy
Introduction
A Word About Our Recommendations
Why Two Scoops of Django?
Before You Begin
This Book Is Intended for Django 3.x and Python 3.8 or 3.9
Each Chapter Stands On Its Own
Conventions Used in This Book
Core Concepts
Keep It Simple, Stupid
Fat Models, Utility Modules, Thin Views, Stupid Templates
Start With Django By Default
Be Familiar with Django's Design Philosophies
The Twelve-Factor App
Our Writing Concepts
Provide the Best Material
Stand on the Shoulders of Giants
Listen to Our Readers and Reviewers
Publish Errata
1 Coding Style
1.1 The Importance of Making Your Code Readable
1.2 PEP 8
1.2.1 The 79-Character Limit
1.3 The Word on Imports
1.4 Understand Explicit Relative Imports
1.5 Avoid Using Import *
1.5.1 Other Python Naming Collisions
1.6 Django Coding Style
1.6.1 Consider the Django Coding Style Guidelines
1.6.2 Use Underscores in URL Pattern Names Rather Than Dashes
1.6.3 Use Underscores in Template Block Names Rather Than Dashes
1.7 Choose JS, HTML, and CSS Style Guides
1.7.1 JavaScript Style Guides
1.7.2 HTML and CSS Style Guides
1.8 Never Code to the IDE (Or Text Editor)
1.9 Summary
2 The Optimal Django Environment Setup
2.1 Use the Same Database Engine Everywhere
2.1.1 You Can't Examine an Exact Copy of Production Data Locally
2.1.2 Different Databases Have Different Field Types/Constraints
2.1.3 Fixtures Are Not a Magic Solution
2.2 Use Pip and (Virtualenv or venv)
2.2.1 virtualenvwrapper
2.3 Install Django and Other Dependencies via Pip
2.4 Use Git For Version Control
2.5 Optional: Identical Environments
2.5.1 Docker
2.6 Summary
3 How to Lay Out Django Projects
3.1 Django 3's Default Project Layout
3.2 Our Preferred Project Layout
3.2.1 Top Level: Repository Root
3.2.2 Second Level: Django Project Root
3.2.3 Second Level: Configuration Root
3.3 Sample Project Layout
3.4 What About the Virtualenv?
3.4.1 Listing Current Dependencies
3.5 Going Beyond startproject
3.5.1 Generating Project Boilerplate With Cookiecutter
3.5.2 Generating a Starting Project With Cookiecutter Django
3.6 Other Alternatives to startproject
3.7 Summary
4 Fundamentals of Django App Design
4.1 The Golden Rule of Django App Design
4.1.1 A Practical Example of Apps in a Project
4.2 What to Name Your Django Apps
4.3 When in Doubt, Keep Apps Small
4.4 What Modules Belong in an App?
4.4.1 Common App Modules
4.4.2 Uncommon App Modules
4.5 Alternative: Ruby on Rails-Style Approaches
4.5.1 Service Layers
4.5.2 The Large Single App Project
4.6 Summary
5 Settings and Requirements Files
5.1 Avoid Non-Versioned Local Settings
5.2 Using Multiple Settings Files
5.2.1 A Development Settings Example
5.2.2 Multiple Development Settings
5.3 Separate Configuration From Code
5.3.1 A Caution Before Using Environment Variables for Secrets
5.3.2 How to Set Environment Variables Locally
5.3.3 How to Unset Environment Variables Locally
5.3.4 How to Set Environment Variables in Production
5.3.5 Handling Missing Secret Key Exceptions
5.4 When You Can't Use Environment Variables
5.4.1 Using JSON Files
5.4.2 Using .env, Config, YAML, and XML File Formats
5.5 Using Multiple Requirements Files
5.5.1 Installing From Multiple Requirements Files
5.6 Handling File Paths in Settings
5.7 Summary
6 Model Best Practices
6.1 Basics
6.1.1 Break Up Apps With Too Many Models
6.1.2 Be Careful With Model Inheritance
6.1.3 Model Inheritance in Practice: The TimeStampedModel
6.2 Database Migrations
6.2.1 Tips for Creating Migrations
6.2.2 Adding Python Functions and Custom SQL to Migrations
6.3 Overcoming Common Obstacles of RunPython
6.3.1 Getting Access to a Custom Model Manager's Methods
6.3.2 Getting Access to a Custom Model Method
6.3.3 Use RunPython.noop to Do Nothing
6.3.4 Deployment and Management of Migrations
6.4 Django Model Design
6.4.1 Start Normalized
6.4.2 Cache Before Denormalizing
6.4.3 Denormalize Only if Absolutely Needed
6.4.4 When to Use Null and Blank
6.4.5 When to Use BinaryField
6.4.6 Try to Avoid Using Generic Relations
6.4.7 Make Choices and Sub-Choices Model Constants
6.4.8 Using Enumeration Types for Choices
6.4.9 PostgreSQL-Specific Fields: When to Use Null and Blank
6.5 The Model _meta API
6.6 Model Managers
6.7 Understanding Fat Models
6.7.1 Model Behaviors a.k.a Mixins
6.7.2 Stateless Helper Functions
6.7.3 Model Behaviors vs Helper Functions
6.8 Additional Resources
6.9 Summary
7 Queries and the Database Layer
7.1 Use get_object_or_404() for Single Objects
7.2 Be Careful With Queries That Might Throw Exceptions
7.2.1 ObjectDoesNotExist vs. DoesNotExist
7.2.2 When You Just Want One Object but Get Three Back
7.3 Use Lazy Evaluation to Make Queries Legible
7.3.1 Chaining Queries for Legibility
7.4 Lean on Advanced Query Tools
7.4.1 Query Expressions
7.4.2 Database Functions
7.5 Don't Drop Down to Raw SQL Until It's Necessary
7.6 Add Indexes as Needed
7.7 Transactions
7.7.1 Wrapping Each HTTP Request in a Transaction
7.7.2 Explicit Transaction Declaration
7.7.3 django.http.StreamingHttpResponse and Transactions
7.7.4 Transactions in MySQL
7.7.5 Django ORM Transaction Resources
7.8 Summary
8 Function- And Class-Based Views
8.1 When to Use FBVs or CBVs
8.2 Keep View Logic Out of URLConfs
8.3 Stick to Loose Coupling in URLConfs
8.3.1 What if We Aren't Using CBVs?
8.4 Use URL Namespaces
8.4.1 Makes for Shorter, More Intuitive, and Don't Repeat Yourself URL Names
8.4.2 Increases Interoperability With Third-Party Libraries
8.4.3 Easier Searches, Upgrades, and Refactors
8.4.4 Allows for More App and Template Reverse Tricks
8.5 Try to Keep Business Logic Out of Views
8.6 Django Views Are Functions
8.6.1 The Simplest Views
8.7 Don't Use locals() as Views Context
8.8 Summary
9 Best Practices for Function-Based Views
9.1 Advantages of FBVs
9.2 Passing the HttpRequest Object
9.3 Decorators Are Sweet
9.3.1 Be Conservative With Decorators
9.3.2 Additional Resources on Decorators
9.4 Passing the HttpResponse Object
9.5 Additional Resources for Function-Based Views
9.6 Summary
10 Best Practices for Class-Based Views
10.1 Guidelines When Working With CBVs
10.2 Using Mixins With CBVs
10.3 Which Django GCBV Should Be Used for What Task?
10.4 General Tips for Django CBVs
10.4.1 Constraining Django CBV/GCBV Access to Authenticated Users
10.4.2 Performing Custom Actions on Views With Valid Forms
10.4.3 Performing Custom Actions on Views With Invalid Forms
10.4.4 Using the View Object
10.5 How GCBVs and Forms Fit Together
10.5.1 Views + ModelForm Example
10.5.2 Views + Form Example
10.6 Using Just django.views.generic.View
10.7 Additional Resources
10.8 Summary
11 Asynchronous Views
11.1 Notes from Analyzing Django 3.1a Pre-Release Async Views
11.2 Resources
12 Common Patterns for Forms
12.1 Pattern 1: Simple ModelForm With Default Validators
12.2 Pattern 2: Custom Form Field Validators in ModelForms
12.3 Pattern 3: Overriding the Clean Stage of Validation
12.4 Pattern 4: Hacking Form Fields (2 CBVs, 2 Forms, 1 Model)
12.5 Pattern 5: Reusable Search Mixin View
12.6 Summary
13 Form Fundamentals
13.1 Validate All Incoming Data With Django Forms
13.2 Use the POST Method in HTML Forms
13.3 Always Use CSRF Protection With HTTP Forms That Modify Data
13.3.1 Posting Data via AJAX
13.4 Understand How to Add Django Form Instance Attributes
13.5 Know How Form Validation Works
13.5.1 ModelForm Data Is Saved to the Form, Then the Model Instance
13.6 Add Errors to Forms With Form.add_error()
13.6.1 Other Useful Form Methods
13.7 Fields Without Pre-Made Widgets
13.8 Customizing Widgets
13.8.1 Overriding the HTML of Built-In Widgets
13.8.2 Creating New Custom Widgets
13.9 Additional Resources
13.10 Summary
14 Templates: Best Practices
14.1 Keep Templates Mostly in templates/
14.2 Template Architecture Patterns
14.2.1 2-Tier Template Architecture Example
14.2.2 3-Tier Template Architecture Example
14.2.3 Flat Is Better Than Nested
14.3 Limit Processing in Templates
14.3.1 Gotcha 1: Aggregation in Templates
14.3.2 Gotcha 2: Filtering With Conditionals in Templates
14.3.3 Gotcha 3: Complex Implied Queries in Templates
14.3.4 Gotcha 4: Hidden CPU Load in Templates
14.3.5 Gotcha 5: Hidden REST API Calls in Templates
14.4 Don't Bother Making Your Generated HTML Pretty
14.5 Exploring Template Inheritance
14.6 block.super Gives the Power of Control
14.7 Useful Things to Consider
14.7.1 Avoid Coupling Styles Too Tightly to Python Code
14.7.2 Common Conventions
14.7.3 Use Implicit and Named Explicit Context Objects Properly
14.7.4 Use URL Names Instead of Hardcoded Paths
14.7.5 Debugging Complex Templates
14.8 Error Page Templates
14.9 Follow a Minimalist Approach
14.10 Summary
15 Template Tags and Filters
15.1 Filters Are Functions
15.1.1 Filters Are Easy to Test
15.1.2 Filters and Code Reuse
15.1.3 When to Write Filters
15.2 Custom Template Tags
15.2.1 Template Tags Are Harder to Debug
15.2.2 Template Tags Make Code Reuse Harder
15.2.3 The Performance Cost of Template Tags
15.2.4 When to Write Template Tags
15.3 Naming Your Template Tag Libraries
15.4 Loading Your Template Tag Modules
15.4.1 Watch Out for This Anti-Pattern
15.5 Summary
16 Django Templates and Jinja2
16.1 What's the Syntactical Difference?
16.2 Should I Switch?
16.2.1 Advantages of DTL
16.2.2 Advantages of Jinja2
16.2.3 Which One Wins?
16.3 Considerations When Using Jinja2 With Django
16.3.1 CSRF and Jinja2
16.3.2 Using Template Tags in Jinja2 Templates
16.3.3 Using Django-Style Template Filters in Jinja2 Templates
16.3.4 The Jinja2 Environment Object Should Be Considered Static
16.4 Resources
16.5 Summary
17 Building REST APIs With Django REST Framework
17.1 Fundamentals of Basic REST API Design
17.2 Illustrating Design Concepts With a Simple API
17.3 REST API Architecture
17.3.1 Use Consistent API Module Naming
17.3.2 Code for a Project Should Be Neatly Organized
17.3.3 Code for an App Should Remain in the App
17.3.4 Try to Keep Business Logic Out of API Views
17.3.5 Grouping API URLs
17.3.6 Test Your API
17.3.7 Version Your API
17.3.8 Be Careful With Customized Authentication Schemes
17.4 When DRF Gets in the Way
17.4.1 Remote Procedure Calls vs REST APIs
17.4.2 Problems With Complex Data
17.4.3 Simplify! Go Atomic!
17.5 Shutting Down an External API
17.5.1 Step #1: Notify Users of Pending Shut Down
17.5.2 Step #2: Replace API With 410 Error View
17.6 Rate-Limiting Your API
17.6.1 Unfettered API Access Is Dangerous
17.6.2 REST Frameworks Must Come With Rate Limiting
17.6.3 Rate Limiting Can Be a Business Plan
17.7 Advertising Your REST API
17.7.1 Documentation
17.7.2 Provide Client SDKs
17.8 Additional Reading
17.9 Other Approaches for Crafting APIs
17.9.1 CBV Approach: JsonResponse with View
17.9.2 FBV approach: django-jsonview
17.9.3 django-tastypie
17.10 Summary
18 Building GraphQL APIs With Django
18.1 Dispelling the Performance Myth
18.2 GraphQL API Architecture
18.2.1 Don't Use Sequential Keys as Public Identifiers
18.2.2 Use Consistent API Module Naming
18.2.3 Try to Keep Business Logic Out of API Views
18.2.4 Test Your API
18.2.5 Version Your API
18.2.6 Be Careful With Customized Authentication Schemes
18.3 Shutting Down an External API
19 JavaScript and Django
19.1 Popular JavaScript Approaches
19.1.1 Building Single Page Apps When Multi-Page Apps Suffice
19.1.2 Upgrading Legacy Sites
19.1.3 Not Writing Tests
19.1.4 Not Understanding JavaScript Memory Management
19.1.5 Storing Data in the DOM When It's Not jQuery
19.2 Consuming Django-served APIs with JavaScript
19.2.1 Learn How to Debug the Client
19.2.2 When Possible, Use JavaScript-Powered Static Asset Preprocessors
19.3 Real-Time Woes a.k.a. Latency
19.3.1 Solution: Mask the Latency With Animations
19.3.2 Solution: Fake Successful Transactions
19.3.3 Solution: Geographically Based Servers
19.3.4 Solution: Restrict Users Geographically
19.3.5 AJAX and the CSRF Token
19.4 Using JavaScript with Templates Served by Django
19.4.1 JavaScript Can Go In the Header Again
19.4.2 Use JSON Encoding for Data Consumed by JavaScript
19.5 Strengthening JavaScript Skills
19.5.1 Learn More JavaScript!
19.6 Follow JavaScript Coding Standards
19.7 Summary
20 Tradeoffs of Replacing Core Components
20.1 The Temptation to Build FrankenDjango
20.2 Non-Relational Databases vs. Relational Databases
20.2.1 Not All Non-Relational Databases Are ACID Compliant
20.2.2 Don't Use Non-Relational Databases for Relational Tasks
20.2.3 Ignore the Hype and Do Your Own Research
20.2.4 How We Use Non-Relational Databases With Django
20.3 What About Replacing the Django Template Language?
20.4 Summary
21 Working With the Django Admin
21.1 It's Not for End Users
21.2 Admin Customization vs. New Views
21.3 Viewing String Representations of Objects
21.3.1 Using __str__()
21.3.2 Using list_display
21.4 Adding Callables to ModelAdmin Classes
21.5 Be Aware of the Complications of Multiuser Environments
21.6 Django's Admin Documentation Generator
21.7 Using Custom Skins With the Django Admin
21.7.1 Evaluation Point: Documentation is Everything
21.7.2 Write Tests for Any Admin Extensions You Create
21.8 Secure the Django Admin
21.8.1 Change the Default Admin URL
21.8.2 Use django-admin-honeypot
21.8.3 Only Allow Admin Access via HTTPS
21.8.4 Limit Admin Access Based on IP
21.9 Securing the Admin Docs
21.10 Summary
22 Dealing With the User Model
22.1 Use Django's Tools for Finding the User Model
22.1.1 Use settings.AUTH_USER_MODEL for Foreign Keys to User
22.1.2 Don't Use get_user_model() for Foreign Keys to User
22.2 Custom User Fields for Django Projects
22.2.1 Option 1: Subclass AbstractUser
22.2.2 Option 2: Subclass AbstractBaseUser
22.2.3 Option 3: Linking Back From a Related Model
22.3 Handling Multiple User Types
22.3.1 Add a User Type Field
22.3.2 Add a User Type Field Plus Proxy Models
22.3.3 Adding Extra Data Fields
22.3.4 Additional Resources on Multiple User Types
22.4 Summary
23 Django's Secret Sauce: Third-Party Packages
23.1 Examples of Third-Party Packages
23.2 Know About the Python Package Index
23.3 Know About DjangoPackages.org
23.4 Know Your Resources
23.5 Tools for Installing and Managing Packages
23.6 Package Requirements
23.7 Wiring Up Django Packages: The Basics
23.7.1 Step 1: Read the Documentation for the Package
23.7.2 Step 2: Add Package and Version Number to Your Requirements
23.7.3 Step 3: Install the Requirements Into Your Virtualenv
23.7.4 Step 4: Follow the Package's Installation Instructions Exactly
23.8 Troubleshooting Third-Party Packages
23.9 Releasing Your Own Django Packages
23.10 What Makes a Good Django Package?
23.10.1 Purpose
23.10.2 Scope
23.10.3 Documentation
23.10.4 Tests
23.10.5 Templates
23.10.6 Activity
23.10.7 Community
23.10.8 Modularity
23.10.9 Availability on PyPI
23.10.10 Uses the Broadest Requirements Specifiers Possible
23.10.11 Proper Version Numbers
23.10.12 Name
23.10.13 License
23.10.14 Clarity of Code
23.10.15 Use URL Namespaces
23.11 Creating Your Own Packages the Easy Way
23.12 Maintaining Your Open Source Package
23.12.1 Give Credit for Pull Requests
23.12.2 Handling Bad Pull Requests
23.12.3 Do Formal PyPI Releases
23.12.4 Create and Deploy Wheels to PyPI
23.12.5 Add Git Tags to the Repo
23.12.6 Upgrade the Package to New Versions of Django
23.12.7 Follow Good Security Practices
23.12.8 Provide Sample Base Templates
23.12.9 Give the Package Away
23.13 Additional Reading
23.14 Summary
24 Testing Stinks and Is a Waste of Money!
24.1 Testing Saves Money, Jobs, and Lives
24.2 How to Structure Tests
24.3 How to Write Unit Tests
24.3.1 Each Test Method Tests One Thing
24.3.2 For Views, When Possible Use the Request Factory
24.3.3 Don't Write Tests That Have to Be Tested
24.3.4 Don't Repeat Yourself Doesn't Apply to Writing Tests
24.3.5 Don't Rely on Fixtures
24.3.6 Things That Should Be Tested
24.3.7 Test for Failure
24.3.8 Use Mock to Keep Unit Tests From Touching the World
24.3.9 Use Fancier Assertion Methods
24.3.10 Document the Purpose of Each Test
24.4 What About Integration Tests?
24.5 Continuous Integration
24.6 Who Cares? We Don't Have Time for Tests!
24.7 The Game of Test Coverage
24.8 Setting Up the Test Coverage Game
24.8.1 Step 1: Start Writing Tests
24.8.2 Step 2: Run Tests and Generate Coverage Report
24.8.3 Step 3: Generate the Report!
24.9 Playing the Game of Test Coverage
24.10 Alternatives to unittest
24.11 Summary
25 Documentation: Be Obsessed
25.1 Use GitHub-Flavored Markdown for Docs
25.2 Use MkDocs or Sphinx with Myst to Generate Documentation From Markdown
25.3 What Docs Should Django Projects Contain?
25.4 Additional Markdown Documentation Resources
25.5 The ReStructuredText Alternative
25.5.1 ReStructuredText Resources
25.6 When Documentation Needs to Be Convert to/from Markdown or ReStructuredText
25.7 Wikis and Other Documentation Methods
25.8 Ensuring that Code is Documented
25.9 Summary
26 Finding and Reducing Bottlenecks
26.1 Should You Even Care?
26.2 Speed Up Query-Heavy Pages
26.2.1 Find Excessive Queries With Django Debug Toolbar
26.2.2 Reduce the Number of Queries
26.2.3 Speed Up Common Queries
26.2.4 Switch ATOMIC_REQUESTS to False
26.3 Get the Most Out of Your Database
26.3.1 Know What Doesn't Belong in the Database
26.3.2 Getting the Most Out of PostgreSQL
26.3.3 Getting the Most Out of MySQL
26.4 Cache Queries With Memcached or Redis
26.5 Identify Specific Places to Cache
26.6 Consider Third-Party Caching Packages
26.7 Compression and Minification of HTML, CSS, and JavaScript
26.8 Use Upstream Caching or a Content Delivery Network
26.9 Other Resources
26.10 Summary
27 Asynchronous Task Queues
27.1 Do We Need a Task Queue?
28 Security Best Practices
28.1 Reference Security Sections in Other Chapters
28.2 Harden Your Servers
28.3 Know Django's Security Features
28.4 Turn Off DEBUG Mode in Production
28.5 Keep Your Secret Keys Secret
28.6 HTTPS Everywhere
28.6.1 Use Secure Cookies
28.6.2 Use HTTP Strict Transport Security (HSTS)
28.6.3 HTTPS Configuration Tools
28.7 Use Allowed Hosts Validation
28.8 Always Use CSRF Protection With HTTP Forms That Modify Data
28.9 Prevent Against Cross-Site Scripting (XSS) Attacks
28.9.1 Use format_html Over mark_safe
28.9.2 Don't Allow Users to Set Individual HTML Tag Attributes
28.9.3 Use JSON Encoding for Data Consumed by JavaScript
28.9.4 Beware Unusual JavaScript
28.9.5 Add Content Security Policy Headers
28.9.6 Additional Reading
28.10 Defend Against Python Code Injection Attacks
28.10.1 Python Built-Ins That Execute Code
28.10.2 Python Standard Library Modules That Can Execute Code
28.10.3 Third-Party Libraries That Can Execute Code
28.10.4 Be Careful With Cookie-Based Sessions
28.11 Validate All Incoming Data With Django Forms
28.12 Disable the Autocomplete on Payment Fields
28.13 Handle User-Uploaded Files Carefully
28.13.1 When a CDN Is Not an Option
28.13.2 Django and User-Uploaded Files
28.14 Don't Use ModelForms.Meta.exclude
28.14.1 Mass Assignment Vulnerabilities
28.15 Don't Use ModelForms.Meta.fields = "all"
28.16 Beware of SQL Injection Attacks
28.17 Don't Store Unnecessary Data
28.17.1 Never Store Credit Card Data
28.17.2 Don't Store PII or PHI Unless Required (By Law)
28.18 Monitor Your Sites
28.19 Keep Your Dependencies Up-to-Date
28.20 Prevent Clickjacking
28.21 Guard Against XML Bombing With defusedxml
28.22 Explore Two-Factor Authentication
28.23 Embrace SecurityMiddleware
28.24 Force the Use of Strong Passwords
28.25 Don't Prevent Copy/Pasting of Password
28.26 Give Your Site a Security Checkup
28.27 Put Up a Vulnerability Reporting Page
28.28 Never Display Sequential Primary Keys
28.28.1 Lookup by Slug
28.28.2 UUIDs
28.29 Upgrade Password Hasher to Argon2
28.30 Use SRI When Loading Static Assets From External Sources
28.31 Reference Our Security Settings Appendix
28.32 Review the List of Security Packages
28.33 Keep Up-to-Date on General Security Practices
28.34 Summary
29 Logging: What's It For, Anyway?
29.1 Application Logs vs. Other Logs
29.2 Why Bother With Logging?
29.3 When to Use Each Log Level
29.3.1 Log Catastrophes With CRITICAL
29.3.2 Log Production Errors With ERROR
29.3.3 Log Lower-Priority Problems With WARNING
29.3.4 Log Useful State Information With INFO
29.3.5 Log Debug-Related Messages to DEBUG
29.4 Log Tracebacks When Catching Exceptions
29.5 One Logger Per Module That Uses Logging
29.6 Log Locally to Rotating Files
29.7 Other Logging Tips
29.8 Necessary Reading Material
29.9 Useful Third-Party Tools
29.10 Summary
30 Signals: Use Cases and Avoidance Techniques
31 What About Those Random Utilities?
31.1 Create a Core App for Your Utilities
31.2 Optimize Apps With Utility Modules
31.2.1 Storing Code Used in Many Places
31.2.2 Trimming Models
31.2.3 Easier Testing
31.3 Django's Own Swiss Army Knife
31.3.1 django.contrib.humanize
31.3.2 django.utils.decorators.method_decorator(decorator)
31.3.3 django.utils.decorators.decorator_from_middleware(middleware)
31.3.4 django.utils.encoding.force_text(value)
31.3.5 django.utils.functional.cached_property
31.3.6 django.utils.html.format_html(format_str, *args, **kwargs)
31.3.7 django.utils.html.strip_tags(value)
31.3.8 django.utils.text.slugify(value)
31.3.9 Slugification and Languages Besides English
31.3.10 django.utils.timezone
31.3.11 django.utils.translation
31.4 Exceptions
31.4.1 django.core.exceptions.ImproperlyConfigured
31.4.2 django.core.exceptions.ObjectDoesNotExist
31.4.3 django.core.exceptions.PermissionDenied
31.5 Serializers and Deserializers
31.5.1 django.core.serializers.json.DjangoJSONEncoder
31.5.2 django.core.serializers.pyyaml
31.5.3 django.core.serializers.xml_serializer
31.5.4 rest_framework.serializers
31.6 Summary
32 Deployment: Platforms as a Service
33 Deploying Django Projects
34 Continuous Integration
35 The Art of Debugging
36 Where and How to Ask Django Questions
37 Closing Thoughts
Appendix A: Packages Mentioned In This Book
Appendix B: Troubleshooting Installation
Appendix C: Additional Resources
Timeless Python and Django Material
Timeless Beginner Django Material
Timeless Beginner Python Material
Timeless Useful Python Material
JavaScript Resources
Appendix D: Internationalization and Localization
Appendix E: Settings Alternatives
Appendix F: Security Settings Reference
Appendix G: Handling Security Failures
Have a Plan Ready for When Things Go Wrong
Shut Everything Down or Put It in Read-Only Mode
Put Up a Static HTML Page
Back Everything Up
Email security@djangoproject.com, Even if It's Your Fault
Start Looking Into the Problem
Appendix H: WebSockets with Channels
Each Browser Tab Has Its Own WebSocket Connection
Expect WebSocket Connections to Drop All the Time
Validate Incoming Data!
Acknowledgments
List of Figures
List of Tables
Index