Federico Marani
Practical Django 2 and Channels 2Building Projects and Applications with Real-Time Capabilities
Federico Marani
London, UK
ISBN 978-1-4842-4098-4e-ISBN 978-1-4842-4099-1
Library of Congress Control Number: 2018965934
© Federico Marani 2019
This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed.
Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of publication, neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or omissions that may be made. The publisher makes no warranty, express or implied, with respect to the material contained herein.
Distributed to the book trade worldwide by Springer Science+Business Media New York, 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail [email protected], or visit www.springeronline.com. Apress Media, LLC is a California LLC and the sole member (owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation.
Introduction

Nowadays, everything can be done through the Web. Ordering food, booking holidays, hailing taxis . . . you name it. Most banking transactions no longer require you to go to the bank. You can make most purchases online.

My intention when writing this book is to cover enough use cases from the real world, without being too focused on a specific business. If you are reading this book, it is because you want to equip yourself with the knowledge to build many of these popular systems.

This book approaches teaching in a very practical way. You will not find much theory in this book, not because it is not useful, but because I believe in understanding the theory by looking at how things work in practice. I am putting emphasis on the word “Practical” by having it in the book title, so be warned!

We are going to build an e-commerce presence for a fictitious company called BookTime, which sells books online. E-commerce is a good paradigm to use because you very likely have experienced it as a user, and it is also where much of my experience comes from.

We will build the online catalog, the checkout process, internal dashboards, integrations with distribution companies, and real-time components that will be used through a mobile application.

This book will put Django at the center of our attention, but it is not possible to do everything in Django. Django is part of a bigger ecosystem of tools, and if some of these are a better fit for our purpose, we will use those instead.

We will use Bootstrap, React, Webpack, and React Native in this book. These tools are needed to reach solutions that will improve the user experience, shorten our time to develop, and follow what most of the Django community does in practice.

We will also integrate Django with some common Django libraries managed by its community: Django-extensions, factory_boy, Django Debug Toolbar, Django-tables2, Django-filter, Django Rest Framework, and, most importantly, Django Channels.

Django Channels is a new piece in the Django ecosystem that allows us to solve a class of problems that standard Django does not solve well: event-driven programming. Event-driven programming is the best paradigm to use when a system has high input/output load, which goes beyond normal HTTP request/response traffic. Chat systems fit in this, because people do not talk by following a request/response pattern.

I encourage you to see these decisions as pragmatic, but not ultimate. Ultimately, you are free to use any libraries you want. I am also conscious that what might be a good decision for me is not necessarily good for you.

This book is for people who already have a basic understanding of Python and want to follow this journey of going from zero to have a good e-commerce platform. Chapters will start simple and build up complexity as you get toward the end of this book.

I hope that the journey we are going to go through will serve you well as a reference in the future when you implement your project in Django.

Table of Contents

Index 397

About the Author and About the Technical Reviewer

About the Author

Federico Marani
../images/466106_1_En_BookFrontmatter_Figb_HTML.jpg

has been a freelance software engineer and DevOps specialist for over 15 years. With a background in computer science and an MSc in Business Psychology, he has worked in companies ranging from e-commerce companies to finance, medical, and banking companies. He started developing web applications with Python 1.5.2 on Red Hat systems and has been using Django since the first 1.x versions, more than 8 years ago. Federico now consults on technology strategy and tech teams with startups, and still is very hands-on with coding. He has open sourced a lot of code online, some of which is part of GNU Social. In his spare time, he enjoys playing drums and running. He can be contacted via https://federicomarani.me .

 

About the Technical Reviewer

Steve Jalim
../images/466106_1_En_BookFrontmatter_Figc_HTML.jpg

is a senior web developer and consultant who has worked with Django since version 0.9. He has used it to build robust applications for a wide range of clients, from high-growth startups to international charities, across a diverse set of domains, including supply-chain tracking, freelancer marketplaces, environmental campaigns, and even online karaoke. Steve lives with his young family in a hilly part of the UK, where he enjoys trail running. He can be contacted via https://www.stevejalim.co.uk .

 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.139.107.241