Book Image

Django 2 by Example

By : Antonio Melé
Book Image

Django 2 by Example

By: Antonio Melé

Overview of this book

If you want to learn the entire process of developing professional web applications with Django 2, then this book is for you. You will walk through the creation of four professional Django 2 projects, teaching you how to solve common problems and implement best practices. You will learn how to build a blog application, a social image bookmarking website, an online shop and an e-learning platform. The book will teach you how to enhance your applications with AJAX, create RESTful APIs and set up a production environment for your Django 2 projects. The book walks you through the creation of real-world applications, solving common problems, and implementing best practices. By the end of this book, you will have a deep understanding of Django 2 and how to build advanced web applications.
Table of Contents (15 chapters)

What this book covers

Chapter 1, Building a Blog Application, introduces you to the framework by creating 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 ORM, and you will configure the Django administration site.

Chapter 2, Enhancing Your Blog with Advanced Features, teaches you how to handle forms and model forms, 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 also guides 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 also shows 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 learn how to create a custom user profile model and build social authentication into your project using major social networks.

Chapter 5, Sharing Content in Your Website, teaches 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 shows you how to generate image thumbnails and create custom decorators for your views.

Chapter 6, Tracking User Actions, shows 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. 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, teaches you how to create a coupon system to apply discounts to orders. The chapter shows you how to add internationalization to your project and how to translate models. You will also build a product recommendation engine using Redis.

Chapter 10, Building an E-Learning Platform, guides 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 create a content management system and handle formsets.

Chapter 11, Rendering and Caching Content, shows you how to create a student registration system and manage student enrollment on courses. You will render diverse course content and you will learn how to use the cache framework.

Chapter 12, Building an API, explores building a RESTful API for your project using the Django REST framework.

Chapter 13Going Live, shows how to set up a production environment using uWSGI and NGINX, and how to secure it with SSL. The chapter explains how to build a custom middleware and create custom management commands.