Django 3 By Example book

Antonio Melé

Download a free chapter

Enter your name and e-mail to download a free chapter

What people say

This book stems from the experience acquired by Antonio during several years spent in the field developing real-world applications. If you've ever asked yourself "how something should be done", you will most likely find a solid answer here.

Giuseppe Ciotta
Director of Engineering at Eventbrite

The topics covered on this book are based on real work situations, that will help you get the job done and learn in the process! Extensive analysis of each problem that takes you from point A to point B. A must have if you're looking into doing Django based projects professionally.

Panos Laganakos
Software Engineer at BreathResearch Inc

The topics covered in the book are among the most demanded by the web industry today. This book is the perfect extension to the official Django documentation, and is as good a reading experience for perfectionists with deadlines as for those looking to build a professional website.

Daniel Rus
Independent Software Engineer

The examples in the book are just awesome! This is a hands-on guide on how to do real world applications. If you are new to Django, I'd recommend you to read this book and build the example applications. You'll be doing great stuff in no time!

Jaakko Tulkki
Lead Developer at Barclays

Editions in other languages

Django 3项目实例精解
ISBN: 9787302581840
Aprenda Django 3 com exemplos
ISBN: 9786586057232
Django 3. Praktyczne tworzenie aplikacji sieciowych. Wydanie III
ISBN: 9788328372504
Django 3 kroz primere, prevod III izdanja
ISBN: 9788673105529

Learn Django building practical, real-world applications

Django 3 by Example will guide you through the entire process of developing professional web applications with Django. The book not only covers the most relevant aspects of the framework, but it will also teach you how to integrate other popular technologies into your Django projects.

The book will walk you through the creation of four real-world applications, solving common problems, and implementing best practices, using a step-by-step approach that is easy to follow.

After reading this book, you will have a good understanding of how Django works and how to build practical, advanced web applications.




professional Django projects

Build four different real-world applications

Blog application

Image sharing website

On-line shop

E-learning platform

Book chapters


Chapter 1, Building a Blog Application

This chapter will introduce you to the framework through a blog application. You will create the basic blog models, views, templates, and URLs to display blog posts. You will learn how to build QuerySets with the Django object- relational mapper (ORM), and you will configure the Django administration site.


Chapter 2, Enhancing Your Blog with Advanced Features

This chapter will teach you how to handle forms and ModelForms, send emails with Django, and integrate third-party applications. You will implement a comment system for your blog posts and allow your users to share posts via email. The chapter will also guide you through the process of creating a tagging system.


Chapter 3, Extending Your Blog Application

This chapter explores how to create custom template tags and filters. The chapter will also show you how to use the sitemap framework and create an RSS feed for your posts. You will complete your blog application by building a search engine with PostgreSQL's full-text search capabilities.


Chapter 4, Building a Social Website

This chapter explains how to build a social website. You will use the Django authentication framework to create user account views. You will also learn how to create a custom user profile model and build social authentication into your project using major social networks.


Chapter 5, Sharing Content on Your Website

This chapter will teach you how to transform your social application into an image sharing website. You will define many-to-many relationships for models, and you will create an AJAX bookmarklet in JavaScript. The chapter will show you how to generate image thumbnails and create custom decorators for your views.


Chapter 6, Tracking User Actions

This chapter will show you how to build a follower system for users. You will complete your image bookmarking website by creating a user activity stream application. You will learn how to optimize QuerySets, and you will work with signals. Finally, you will integrate Redis into your project to count image views.


Chapter 7, Building an Online Shop

This chapter explores how to create an online shop. You will build catalog models, and you will create a shopping cart using Django sessions. You will build a context processor for the shopping cart, and you will learn how to implement sending asynchronous notifications to users using Celery.


Chapter 8, Managing Payments and Orders

This chapter explains how to integrate a payment gateway into your shop. You will also customize the administration site to export orders to CSV files, and you will generate PDF invoices dynamically.


Chapter 9, Extending Your Shop

This chapter will teach you how to create a coupon system to apply discounts to orders. The chapter will also show you how to add internationalization to your project and how to translate models. Finally, you will build a product recommendation engine using Redis.


Chapter 10, Building an E-Learning Platform

This chapter will guide you through creating an e-learning platform. You will add fixtures to your project, use model inheritance, create custom model fields, use class-based views, and manage groups and permissions. You will also create a content management system and handle formsets.


Chapter 11, Rendering and Caching Content

This chapter will show you how to create a student registration system and manage student enrollment on courses. You will render diverse course contents and learn how to use the cache framework.


Chapter 12, Building an API

This chapter explores building a RESTful API for your project using Django REST framework and how to consume it using the Python Requests library.


Chapter 13, Building a Chat Server

This chapter explains how to use Django Channels to create a real-time chat server for students. You will learn how to implement functionalities that rely on asynchronous communication through WebSockets.


Chapter 14, Going Live

This chapter will show you how to set up a production environment using uWSGI, NGINX, and Daphne. You will learn how to secure the environment through HTTPS. The chapter also explains how to build a custom middleware and create custom management commands.

Use Django with multiple technologies

Antonio Melé

About Antonio Melé

Antonio Melé is the Chief Technology Officer at Nucoro, a London-based fintech company that provides a leading technology platform to build digital wealth management solutions. Antonio has been developing Django projects since 2006 for clients across several industries. In 2009, he founded Zenx IT, a development company specializing in building digital products. Antonio holds an M.Sc. in computer science from ICAI - Universidad Pontificia Comillas. His father inspired his passion for computers and programming.