Django Design Patterns and Best Practices

Easily build maintainable websites with powerful and relevant Django design patterns
Preview in Mapt

Django Design Patterns and Best Practices

Arun Ravindran

1 customer reviews
Easily build maintainable websites with powerful and relevant Django design patterns
Mapt Subscription
FREE
$29.99/m after trial
eBook
$25.20
RRP $35.99
Save 29%
Print + eBook
$44.99
RRP $44.99
What do I get with a Mapt Pro subscription?
  • Unlimited access to all Packt’s 5,000+ eBooks and Videos
  • Early Access content, Progress Tracking, and Assessments
  • 1 Free eBook or Video to download and keep every month after trial
What do I get with an eBook?
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with Print & eBook?
  • Get a paperback copy of the book delivered to you
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with a Video?
  • Download this Video course in MP4 format
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
$0.00
$25.20
$44.99
$29.99p/m after trial
RRP $35.99
RRP $44.99
Subscription
eBook
Print + eBook
Start 30 Day Trial

Frequently bought together


Django Design Patterns and Best Practices Book Cover
Django Design Patterns and Best Practices
$ 35.99
$ 25.20
Angular 2 Design Patterns and Best Practices Book Cover
Angular 2 Design Patterns and Best Practices
$ 35.99
$ 25.20
Buy 2 for $35.00
Save $36.98
Add to Cart
Subscribe and access every Packt eBook & Video.
 
  • 5,000+ eBooks & Videos
  • 50+ New titles a month
  • 1 Free eBook/Video to keep every month
Start Free Trial
 

Book Details

ISBN 139781783986644
Paperback222 pages

Book Description

Learning how to write better Django code to build more maintainable websites either takes a lot of experience or familiarity with various design patterns. Filled with several idiomatic Django patterns, Django Design Patterns and Best Practices accelerates your journey into the world of web development.

Discover a set of common design problems, each tackling aspects of Django including model design and Views, and learn several recommended solutions with useful code examples and illustrations. You'll also get to grips with the current best practices in the latest versions of Django and Python. Creating a successful web application involves much more than Django, so advanced topics including REST, testing, debugging, security, and deployment are also explored in detail.

Table of Contents

Chapter 1: Django and Patterns
Why Django?
The story of Django
What is a Pattern?
Patterns in this book
Best practices
Summary
Chapter 2: Application Design
How to gather requirements
Are you a story teller?
HTML mockups
Designing the application
Before starting the project
SuperBook – your mission, should you choose to accept it
Summary
Chapter 3: Models
M is bigger than V and C
The model hunt
Structural patterns
Retrieval patterns
Migrations
Summary
Chapter 4: Views and URLs
A view from the top
Class-based generic views
View mixins
Decorators
View patterns
Designing URLs
Summary
Chapter 5: Templates
Understanding Django's template language features
Organizing templates
Using Bootstrap
Template patterns
Summary
Chapter 6: Admin Interface
Using the admin interface
Enhancing models for the admin
Admin interface customizations
Protecting the admin
Summary
Chapter 7: Forms
How forms work
Displaying forms
Understanding CSRF
Form processing with Class-based views
Form patterns
Summary
Chapter 8: Dealing with Legacy Code
Finding the Django version
Where are the files? This is not PHP
Starting with urls.py
Jumping around the code
Understanding the code base
Incremental change or a full rewrite?
Write tests before making any changes
Legacy databases
Summary
Chapter 9: Testing and Debugging
Why write tests?
Test-driven development
Writing a test case
Mocking
Pattern – test fixtures and factories
Learning more about testing
Debugging
The print function
Logging
The Django Debug Toolbar
The Python debugger pdb
Other debuggers
Debugging Django templates
Summary
Chapter 10: Security
Cross-site scripting (XSS)
A handy security checklist
Summary
Chapter 11: Production-ready
Production environment
Hosting
Deployment tools
Monitoring
Performance
Summary

What You Will Learn

  • Understand common design patterns that can help you write better Django code
  • Discover the latest best practices and idioms in this rapidly evolving framework
  • Deep dive into various aspects of Django from Models and Views to testing and deployment
  • Get to grips with difficult topics such as dealing with legacy code and debugging
  • Familiarize yourself with the various nuances of web development such as browser attacks and databases
  • Reduce the maintenance burden with well-tested, cleaner code
  • Show your work to the world by learning about hosting, deploying, and securing your Django projects

Authors

Table of Contents

Chapter 1: Django and Patterns
Why Django?
The story of Django
What is a Pattern?
Patterns in this book
Best practices
Summary
Chapter 2: Application Design
How to gather requirements
Are you a story teller?
HTML mockups
Designing the application
Before starting the project
SuperBook – your mission, should you choose to accept it
Summary
Chapter 3: Models
M is bigger than V and C
The model hunt
Structural patterns
Retrieval patterns
Migrations
Summary
Chapter 4: Views and URLs
A view from the top
Class-based generic views
View mixins
Decorators
View patterns
Designing URLs
Summary
Chapter 5: Templates
Understanding Django's template language features
Organizing templates
Using Bootstrap
Template patterns
Summary
Chapter 6: Admin Interface
Using the admin interface
Enhancing models for the admin
Admin interface customizations
Protecting the admin
Summary
Chapter 7: Forms
How forms work
Displaying forms
Understanding CSRF
Form processing with Class-based views
Form patterns
Summary
Chapter 8: Dealing with Legacy Code
Finding the Django version
Where are the files? This is not PHP
Starting with urls.py
Jumping around the code
Understanding the code base
Incremental change or a full rewrite?
Write tests before making any changes
Legacy databases
Summary
Chapter 9: Testing and Debugging
Why write tests?
Test-driven development
Writing a test case
Mocking
Pattern – test fixtures and factories
Learning more about testing
Debugging
The print function
Logging
The Django Debug Toolbar
The Python debugger pdb
Other debuggers
Debugging Django templates
Summary
Chapter 10: Security
Cross-site scripting (XSS)
A handy security checklist
Summary
Chapter 11: Production-ready
Production environment
Hosting
Deployment tools
Monitoring
Performance
Summary

Book Details

ISBN 139781783986644
Paperback222 pages
Read More
From 1 reviews

Read More Reviews

Recommended for You

Mastering Object-oriented Python Book Cover
Mastering Object-oriented Python
$ 26.99
$ 18.90
Web Development with Django Cookbook Book Cover
Web Development with Django Cookbook
$ 29.99
$ 6.00
Python Machine Learning Book Cover
Python Machine Learning
$ 35.99
$ 25.20
Django By Example Book Cover
Django By Example
$ 35.99
$ 25.20
Mastering Web Application Development with AngularJS Book Cover
Mastering Web Application Development with AngularJS
$ 26.99
$ 5.40
Mastering Python Design Patterns Book Cover
Mastering Python Design Patterns
$ 26.99
$ 18.90