Django 3 By Example
Third Edition
Build powerful and reliable Python web applications from scratch
Antonio Mel
BIRMINGHAM - MUMBAI
Django 3 By Example
Third Edition
Copyright 2020 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.
Commissioning Editor: Pavan Ramchandani
Producer: Ben Renow-Clarke
Acquisition Editor Peer Reviews: Suresh Jain
Content Development Editor: Joanne Lovell
Technical Editor: Saby D'silva
Project Editor: Kishor Rit
Proofreader: Safis Editing
Indexer: Pratik Shirodkar
Presentation Designer: Pranit Padwal
First published: November 2015
Second edition: May 2018
Third edition: March 2020
Production reference: 1310320
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-83898-195-2
www.packt.com
This book is dedicated to my parents, Antonio and Lola, who have always supported me in all my ventures.
packt.com
Subscribe to our online digital library for full access to over 7,000 books and videos, as well as industry leading tools to help you plan your personal development and advance your career. For more information, please visit our website.
Why subscribe?
- Spend less time learning and more time coding with practical eBooks and videos from over 4,000 industry professionals
- Learn better with Skill Plans built especially for you
- Get a free eBook or video every month
- Fully searchable for easy access to vital information
- Copy and paste, print, and bookmark content
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.Packt.com and, as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at customercare@packtpub.com for more details.
At www.Packt.com , you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks.
Contributors
About the author
Antonio Mel is the chief technology officer (CTO) 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. He has worked as a CTO and technology consultant for multiple technology-based start-ups and he has managed development teams building projects for large digital businesses. Antonio holds an M.Sc. in computer science from Universidad Pontificia Comillas. His father inspired his passion for computers and programming. You can find out more about Antonio on his website https://antoniomele.es/ .
About the reviewers
Jake Kronika , a senior software engineer with nearly 25 years' experience, has been working with Python since 2005, and Django since 2007. Evolving alongside the web development space, his skill set encompasses HTML5, CSS3, and JavaScript (ECMAScript 6) on the frontend, plus Python, Django, Node.js, PHP, Ruby on Rails, and much more besides on the server side.
Currently a software architect and development team lead, Jake collaborates with skilled designers, business stakeholders, and developers around the world to plan and implement robust web applications. In his spare time, he also provides full-spectrum web services as sole proprietor of Gridline Design and Development, works on home improvement projects, and spends valued time with his wife and two children.
Jake coauthored Django 2 Web Development Cookbook, Third Edition, published in October 2018, and Django 3 Web Development Cookbook, Fourth Edition, published in March 2020. In addition, he has acted as a technical reviewer for several other Packt titles, including:
- Web Development with Django Cookbook Second Edition (2016)
- Developing Responsive Web Applications with AJAX and jQuery (2014)
- jQuery Tools UI Library (2012)
- jQuery UI 1.8: The User Interface Library for jQuery (2011)
- Django JavaScript Integration: AJAX and jQuery (2011)
"I would like to thank my wife, Veronica, for all that she does to support me. Without her, I would be a fraction of the person I am, and would have accomplished only a small percentage of what I've been able to.
Also, I would like to acknowledge my manager, Ravi, for his ongoing support and advice. His guidance has been critical at several points of advancement in my career."
David Stanek has been developing software professionally for over 22 years. He currently enjoys building distributed systems with Kubernetes and cloud technologies. Python has been his language of choice for over 19 years, but he also enjoys writing in Go and other specialized languages. In recent years, he has been involved with various cloud-related projects and enjoys the challenges of running applications at scale. For him, there's nothing better than writing a web service in Python, deploying it on infrastructure orchestrated with Terraform, and automating its business processes with Ansible.
David spends much of his free work time working on open source projects and sharpening his technical skills. He enjoys teaching, reading technical books, and listening to a variety of podcasts and audio books. When he's not working, he enjoys spending time with his beautiful wife, four wonderful children, and miniature dachshund.
You can find out more about David on his website ( http://dstanek.com/ ).
Preface
Django is a powerful Python web framework that encourages rapid development and clean, pragmatic design, while offering a relatively shallow learning curve. This makes it attractive to both novice and expert programmers.
This book 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.