This is the code repository for Django Design Patterns and Best Practices - Second Edition, published by Packt. It contains all the supporting project files necessary to work through the book from start to finish.
Django is one of the most popular web frameworks today. It powers large websites such as Pinterest, Instagram, Disqus, and NASA. With a few lines of code, you can rapidly build a functional and secure website that can scale to millions of users.
This is not a book about Gang of Four design patterns.
Instead, it explains solutions to several common design problems faced by Django developers. Sometimes there are several solutions, but we tend to seek recommended approach. Experienced developers frequently use certain idioms, while deliberately avoiding certain others.
All of the code is organized into folders. Each folder starts with a number followed by the application name. For example, Chapter02.
The code will look like the following:
from django.db import models
class SuperHero(models.Model):
name = models.CharField(max_length=100)
You will just need a computer (PC or Mac) and internet connectivity to start with. Then, ensure that the following are installed:
Python 3.4 or later Django 2 or later (will be covered in installation instructions) Text Editor (or a Python IDE) Web browser (the latest version, please) I recommend working on a Linux-based system such as Ubuntu or Arch Linux. If you are on Windows, you can work on a Linux virtual machine using Vagrant or VirtualBox. Full disclosure, I prefer command-line interfaces, Emacs, and eggs sunny side up. Certain chapters might also require installing certain Python libraries or Django packages.