Django Web Development Books

Django 4.0

Django for Beginners: Build websites with Python and Django

Django for Beginners is a project-based introduction to Django, the popular Python-based web framework. Suitable for total beginners who have never built a website before as well as professional programmers looking for a fast-paced guide to modern web development and Django fundamentals.

In the book you’ll learn how to:

  • Build 5 websites from scratch, including a Blog and Newspaper
  • Deploy online using security best practices
  • Customize the look and feel of your sites
  • Write tests and run them for all your code
  • Integrate user authentication, email, and custom user models
  • Add permissions and authorizations to make your app more secure
Table of Contents
  • Introduction
  • Chapter 1: Initial Set Up
  • Chapter 2: Hello World App
  • Chapter 3: Pages App
  • Chapter 4: Messsage Board App
  • Chapter 5: Blog App
  • Chapter 6: Forms
  • Chapter 7: User Accounts
  • Chapter 8: Custom User Model
  • Chapter 9: User Authentication
  • Chapter 10: Bootstrap
  • Chapter 11: Password Change and Reset
  • Chapter 12: Email
  • Chapter 13: Newspaper App
  • Chapter 14: Permissions and Authorization
  • Chapter 15: Comments
  • Chapter 16: Deployment
  • Conclusion

Boost Your Django DX

During my years working with Django, I’ve picked up many tools and techniques to boost my Developer Experience, or DX. This book covers as many of these as possible, so you can learn them too!


The book contains 12 chapters.
Below is a brief summary of the contents - for a complete breakdown see the release post.

  1. OriginOpening notes, a description of the included examples, acknowledgements, changelog.
  2. DocumentationTools to get you to the right documentation, quicker. Covers DevDocs, DuckDuckGo, Bonus Django Documentation Sites, Wget, and some miscellaneous tips.
  3. Virtual Environments and DependenciesManage environments, and the dependencies within, correctly and easily. Covers venv, virtualenv, pip-tools, pip-lock, recommended practices for dependency management, and Python’s development mode.
  4. Python ShellEnhance your Python command line experience. Covers IPython and django-read-only.
  5. Development ServerMake Django’s runserver better. Covers django-debug-toolbar, Watchman, django-browser-reload, and Rich.
  6. Code Quality ToolsThe key tools to improve your code quality. Covers EditorConfig, pre-commit, Black, isort, and Flake8.
  7. Further Code Quality ToolsMany extra tools useful for Django development. Covers pyupgrade, django-upgrade, pre-commit-hooks, reorder_python_imports, curlylint, DjHTML, Mypy (barely!), Prettier, ESLint, and Shellcheck.
  8. Build Your Own ToolsHow to make your own code quality tools. Covers pre-commit’s virtual languages, how to write and test a Flake8 plugin, and how to write a pre-commit-compatible command line tool.
  9. SettingsTips and patterns for managing Django’s settings file. Covers structuring your settings, a template, some patterns to avoid, and testing settings files.
  10. Models and MigrationsTips and tools for managing your data. Covers writing a management command to seed your development database, generating data with Factory Boy, migration safeguard practices, and django-linear-migrations.
  11. System ChecksMake the most of Django’s built-in runtime code quality framework. Covers how system checks work, how to write and test your own checks, and django-version-checks.
  12. TerminusClosing notes with links to further reading, including many things that didn't make it into the book.


Django for APIs: Build web APIs with Python and Django

Django for APIs is a project-based guide to building modern web APIs with Django & Django REST Framework. It is suitable for beginners who have never built an API before as well as professional programmers looking for a fast-paced introduction to Django fundamentals and best practices.

Over the course of 200+ pages you'll learn how to set up a new project properly, how web APIs work under the hood, and advanced testing and deployment techniques. Three separate projects are built from scratch with progressively more advanced features including a Library API, Todo API, and Blog API. User authentication, permissions, documentation, viewsets, and routers are all covered thoroughly.

Django for APIs is a best-practices guide to building powerful Python-based web APIs with a minimal amount of code.

Table of Contents
  • Introduction
  • Chapter 1: Initial Set Up
  • Chapter 2: Web APIs
  • Chapter 3: Library Website
  • Chapter 4: Library API
  • Chapter 5: Todo API
  • Chapter 6: Blog API
  • Chapter 7: Permissions
  • Chapter 8: User Authentication
  • Chapter 9: Viewsets and Routers
  • Chapter 10: Schemas and Documentation
  • Chapter 11: Production Deployment
  • Conclusion

Django 3.2

Speed Up Your Django Tests

Speed Up Your Django Tests
At the start of March I started writing a blog post called “How to Speed Up Your Django Tests”. Before I knew it, the outline alone was 4,000 words! I realized writing it up would be a major undertaking. As lockdown arrived, I found the time to write it all up.

So, I’m delighted to announce my new book, coming May 18…

Speed Up Your Django Tests!

It’s a practical guide to making your Django project’s tests faster. It has many tips and tricks that apply to all projects, big and small. And it covers the two most popular test runners: Django’s test framework and pytest.

Reducing test run time is the easiest and safest way to increase your speed of delivery. And it’s an organic way of increasing team happiness!

The content is based on my 8 years of experience with tests on Django projects. I’ve sped up many projects’ test suites, improved Django’s own testing framework, and created several pytest plugins.

It contains 13 chapters:

  1. Introduction - Opening notes, how to use the book.
  2. Toolbox - A tour of the various tools you can use to change how your tests run.
  3. Measure! - The importance of profiling, with walkthroughs using two different profilers on a test suite.
  4. Easy Wins - 11 things you can do in 5 minutes to speed up your test suite.
  5. Upgrades - The importance of upgrades, and some how-to guidance to get them done easily.
  6. Parallelize - How to use test suite parallelization to boost your tests.
  7. Migrations - Reduce the overhead of building your test database.
  8. Database Configuration - Tweak your database’s configuration to get more speed.
  9. CI Configuration - And tweak your CI configuration to boost test speed too.
  10. Test Structure - Notes on the best structure for fast, accurate tests, and ways you can restructure.
  11. Test Data - The best strategies for creating data in your tests.
  12. Targeted Mocking - A guide to mocking, and the best libraries for mocking out specific things such as HTTP requests and time.
  13. Outroduction - Closing notes with extra links.

Two Scoops of Django 3.x: Best Practices for the Django Web Framework

540+ pages, 519 while in Alpha

Once again, we're releasing a book chock-full of material that will help you with your Django projects!

In Two Scoops of Django we introduce you to various tips, tricks, patterns, code snippets, and techniques that we’ve picked up over the years. This book is an update and expansion of previous editions:

  • Updated for Django 3.x (which will be maintained by the Django core team until at least April 2024!)
  • Updated to match changes in the Django ecosystem, with corrections and clarifications added thanks to the feedback of our readers and technical reviewers.
  • Updated for Python 3.8 and/or 3.9
  • Revised material on nearly every topic within the book.
  • New material on GraphQL, Django REST Framework, security, forms, models, and more.

Two Scoops of Django 3.x: Best Practices for the Django Web Framework is available in PDF now, possibly Kindle, ePub, and print formats later.

A Wedge of Django: Covers Python 3.8 and Django 3.x

A Wedge of Djangois a guided walkthrough tutorial where we build a real, production-quality Django web application from the ground up.

Originally a large part of our corporate training materials, this tutorial was once only available to companies paying $3000 a seat for in-person training. The contents of this book are professional-grade and have been used by real software companies to get their engineers up and running fast with Python 3.8 and Django 3.x development.

This book is designed to build solid foundations for any developer looking to get proficient with Django fast. 

Django 3.1

Django for Professionals: Production websites with Python and Django

Django for Professionals takes your web development skills to the next level, teaching you how to build production-ready websites with Python and Django.

Once you have learned the basics of Django there is a massive gap between building simple "toy apps" and what it takes to build a "production-ready" web application suitable for deployment to thousands or even millions of users.

In the book you’ll learn how to:

  • Build a Bookstore website from scratch
  • Use Docker and PostgreSQL locally to mimic production settings
  • Implement advanced user registration with email
  • Write comprehensive tests
  • Adopt advanced security and performance improvements
  • Add search and file/image uploads

If you want to take advantage of all that Django has to offer, Django for Professionals is a comprehensive best practices guide to building and deploying modern websites.

Table of Contents

  • Introduction
  • Chapter 1: Docker
  • Chapter 2: PostgreSQL
  • Chapter 3: Bookstore Project
  • Chapter 4: Pages App
  • Chapter 5: User Registration
  • Chapter 6: Static Assets
  • Chapter 7: Advanced User Authentication
  • Chapter 8: Environment Variables
  • Chapter 9: Email
  • Chapter 10: Books App
  • Chapter 11: Reviews App
  • Chapter 12: File/Image Uploads
  • Chapter 13: Permissions
  • Chapter 14: Search
  • Chapter 15: Performance
  • Chapter 16: Security
  • Chapter 17: Deployment
  • Conclusion

Django 3.0

Django 3 by Example

Learn Django 3 with four end-to-end web projects

Key Features

  • Learn Django 3 by building real-world web applications from scratch in Python, using coding best practices
  • Integrate other technologies into your application with clear, step-by-step explanations and comprehensive example code
  • Implement advanced functionalities like a full-text search engine, a user activity stream, or a recommendation engine
  • Add real-time features with Django Channels and WebSockets

Book Description

If you want to learn the entire process of developing professional web applications with Python and Django, then this book is for you. In the process of building four professional Django projects, you will learn about Django 3 features, how to solve common web development problems, how to implement best practices, and how to successfully deploy your applications.

In this book, you will build a blog application, a social image bookmarking website, an online shop, and an e-learning platform. Step-by-step guidance will teach you how to integrate popular technologies, enhance your applications with AJAX, create RESTful APIs, and set up a production environment for your Django projects.

By the end of this book, you will have mastered Django 3 by building advanced web applications.

What you will learn

  • Build real-world web applications
  • Learn Django essentials, including models, views, ORM, templates, URLs, forms, and authentication
  • Implement advanced features such as custom model fields, custom template tags, cache, middleware, localization, and more
  • Create complex functionalities, such as AJAX interactions, social authentication, a full-text search engine, a payment system, a CMS, a RESTful API, and more
  • Integrate other technologies, including Redis, Celery, RabbitMQ, PostgreSQL, and Channels, into your projects
  • Deploy Django projects in production using NGINX, uWSGI, and Daphne

Who this book is for

This book is intended for developers with Python knowledge who wish to learn Django in a pragmatic way. Perhaps you are completely new to Django, or you already know a little but you want to get the most out of it. This book will help you to master the most relevant areas of the framework by building practical projects from scratch. You need to have familiarity with programming concepts in order to read this book. Some previous knowledge of HTML and JavaScript is assumed.

Table of Contents

  1. Building a Blog Application
  2. Enhancing Your Blog with Advanced Features
  3. Extending Your Blog Application
  4. Building a Social Website
  5. Sharing Content on Your Website
  6. Tracking User Actions
  7. Building an Online Shop
  8. Managing Payments and Orders
  9. Extending Your Shop
  10. Building an E-Learning Platform
  11. Rendering and Caching Content
  12. Building an API
  13. Building a Chat Server
  14. Going Live

Django 3 Web Development Cookbook


About this book

Django is a web framework for perfectionists with deadlines, designed to help you build manageable medium and large web projects in a short time span. This fourth edition of the Django Web Development Cookbook is updated with Django 3's latest features to guide you effectively through the development process.

This Django book starts by helping you create a virtual environment and project structure for building Python web apps. You'll learn how to build models, views, forms, and templates for your web apps and then integrate JavaScript in your Django apps to add more features. As you advance, you'll create responsive multilingual websites, ready to be shared on social networks. The book will take you through uploading and processing images, rendering data in HTML5, PDF, and Excel, using and creating APIs, and navigating different data types in Django. You'll become well-versed in security best practices and caching techniques to enhance your website's security and speed. This edition not only helps you work with the PostgreSQL database but also the MySQL database. You'll also discover advanced recipes for using Django with Docker and Ansible in development, staging, and production environments.

By the end of this book, you will have become proficient in using Django's powerful features and will be equipped to create robust websites.

Mastering Django

Mastering Django is the latest version of Mastering Django: Core—the original, best-selling programmer’s reference for Django.

Mastering Django is not just a revision of the original book—it has been completely rewritten from the ground up to meet the needs of modern Django programmers.

The main goal of this book is to make you a Django expert. By reading this book, you’ll learn the skills needed to develop powerful websites quickly, with code that is clean and easy to maintain.

This book is also a programmer’s manual that provides complete coverage of modern Django version 3 and above.

For developers creating applications for commercial and business-critical deployments, Mastering Django delivers a comprehensive, up-to-date resource for the latest versions of Django.

Build a website with Django 3

Build a website with Django 3 is the fourth edition of my popular Django beginners book, fully updated for Django 3.

Not only has the book been updated to cover the latest version of Django, but I've added install instructions for macOS users.

Your complete introduction to Django 3

Build a website with Django 3 covers all the core concepts of Django to get you up and running fast:

Why Django is the premier Python framework for developing web applications

  • The big picture - how Django is structured
  • Django Models
  • Django Views
  • Django Templates
  • The Django admin
  • Generic views
  • Simple forms
  • Complex forms and model forms
  • Managing Users
  • Restricted content
  • File uploads
  • Sending email
  • Deploying a Django application
Build a real website

This book is not about boring theory. You'll be building a fully functioning website as you learn Django. I even show you how to deploy your website to the Internet for free.