Building SPAs with Django and HTML Over the Wire

BIRMINGHAM—MUMBAI

Building SPAs with Django and HTML Over the Wire

Copyright © 2022 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

Group Product Manager: Pavan Ramchandani

Publishing Product Manager: Bhavya Rao

Senior Editor: Mark D'Souza

Content Development Editor: Feza Shaikh

Technical Editor: Simran Udasi

Copy Editor: Safis Editing

Project Coordinator: Manthan Patel

Proofreader: Safis Editing

Indexer: Tejal Daruwale Soni

Production Designer: Joshua Misquitta

Marketing Coordinators: Anamika Singh and Marylou De Mello

First published: August 2022

Production reference: 1290722

Published by Packt Publishing Ltd.

Livery Place

35 Livery Street

Birmingham

B3 2PB, UK.

ISBN 978-1-80324-019-0

www.packt.com

I want to dedicate this book to four people who gave me the necessary tools to make writing it possible:

My mother, for giving me a heart

My grandmother, for giving me an education

My uncle, Toni Hurtado, for giving me wisdom

My girlfriend, Valentina Rubane, for giving me motivation

– Andros Fenollosa

Foreword

This book is about one principle: coordination. How do we coordinate events that occur in different places and at different times within a web application? For example, if multiple users are connected to the same website and need to send messages to each other, how can we achieve fast and effective communication? Such systems are known as real-time applications.

Real-time applications are a standard in web development today. The WebSocket protocol emerged in 2011; it allows you to open a bidirectional tunnel between your web application and another component. The WebSocket protocol creates greater dynamism, and thus improves the user experience. In addition to lower resource consumption, information is updated only when necessary - this avoids redundant requests to the server.

There are many sorts of real-time applications. The first ones that come to mind are social networks or messaging applications since they are part of our daily life. We like to receive information instantly, because we don’t need to refresh the page to know if an event has occurred. We don’t want to wait, we are inherently impatient. Learning how to develop real-time applications gives us an advantage when finding new techniques to start a software project.

This work presents an alternative to JavaScript for creating Single-Page Applications; and some might worry that the author has started a crusade against JavaScript - but it’s not the case. Instead, his interest is in explaining the power of Python using WebSockets over HTML to produce real-time applications.

The author of this book, Andros Fenollosa, is a passionate web developer who, using his extensive teaching experience, will give you the necessary foundations to be involved in the development of real-time application.

Camilo Chacón Sartori,

Ph.D. Student in Computer Science at Artificial Intelligence Research Centre (IIIA)

Contributors

About the author

Andros Fenollosa have been teaching web technologies, best practices, and the fundamentals of functional programming for more than a decade.

Since finishing his studies, he have not stopped developing applications, sometimes as a frontend developer, others as a mobile application developer, backend developer, and project manager. Currently, he is working as CTO in a software development studio.

He combine his professional work maintaining several open source projects related to Python, Django, Clojure (including my own framework: Tadam Web Framework), and Linux. He also like to share his knowledge through podcasting, writing newsletters and books, Twitter, and his blog.

About the reviewer

Norbert Máté is a senior web developer/tech lead with 13+ years of experience. His primary programming languages are Python and JavaScript. He is passionate about software architecture, clean code, and leadership. Norbert has also reviewed other Django books, such as Django RESTful Web Services and Django 2 by Example.

I would like to thank my wife for her support.

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

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