Book Image

Django 3 By Example - Third Edition

By : Antonio Melé
Book Image

Django 3 By Example - Third Edition

By: Antonio Melé

Overview of this book

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.
Table of Contents (17 chapters)
15
Other Books You May Enjoy
16
Index

What this book covers

Chapter 1, Building a Blog Application, 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, 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, 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, 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, will teach you how to transform your social application into an image bookmarking website. You will define many-to-many relationships for models, and you will create an AJAX bookmarklet in JavaScript and integrate it into your project. The chapter will show you how to generate image thumbnails and create custom decorators for your views.

Chapter 6, Tracking User Actions, 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, 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, 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, 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, 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, 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, explores building a RESTful API for your project using Django REST framework.

Chapter 13, Building a Chat Server, 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, 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.