Django 3 Web Development Cookbook
Fourth Edition
Actionable solutions to common problems in Python web development
Aidas Bendoraitis
Jake Kronika
BIRMINGHAM - MUMBAI
Django 3 Web Development CookbookFourth 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 authors, 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: Ravit Jain
Acquisition Editor: Joshua Nadar
Content Development Editor: Keagan Carneiro
Senior Editor: Hayden Edwards
Technical Editor: Suwarna Patil
Copy Editor: Safis Editing
Project Coordinator: Kinjal Bari
Proofreader: Safis Editing
Indexer: Tejal Daruwale Soni
Production Designer: Nilesh Mohite
First published: October 2014
Second edition: January 2016
Third Edition: October 2018
Fourth Edition: March 2020
Production reference: 1230320
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-83898-742-8
www.packt.com
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
Improve your learning 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 authors
Aidas Bendoraitis has been professionally building websites for the past 18 years. For the last 14 years, he has been working at a design company, studio 38 pure communication, in Berlin. Together with a small dedicated team, he has mostly used Django in the backend and jQuery in the frontend to create cultural and touristic web platforms.
Among different side projects, he is bootstrapping a SaaS business with strategic prioritizer 1st things 1st.
Aidas Bendoraitis is active on Twitter and other social media under the username DjangoTricks.
I want to thank my wife, Sofja, and son, Joris, and also other family members and friends for their support while writing this book. I am grateful to my colleagues for sharing knowledge and creating exciting projects together. Also, I want to thank the Django community for great, friendly conferences, and meetups. Last but not least, I appreciate Vilnius University, for planting the initial seeds of my career.
Jake Kronika, a software engineer with 25 years of experience. He has been working with Python since 2005 and Django since 2007. Evolving in lockstep with the web development industry, his skill set encompasses HTML, CSS, full-stack JavaScript, Python, Django , React, Node.js , Ruby on Rails, and several other technologies.
Currently a software architect and development team lead, Jake collaborates with designers, business stakeholders, and engineers around the globe to build robust applications. In his spare time, he provides full-spectrum web services as a freelancer.
In addition to authoring this book, Jake has reviewed several other Packt titles most recently, Django 3 By Example, Third Edition by Antonio Mel.
I would not have accomplished nearly all that I have if it were not for the support and encouragement of my family, friends, and professional connections. In particular, I would like to thank my wife, Veronica, and my children, Mykaela and Kaden, whose love and devotion continue to be an inspiration daily. Also, I want to recognize my childhood friend, Andrew, without whom I may not have built my first website, thus discovering software.
About the reviewers
Darian Schramm has over 14 years of experience working on the web with Python. Starting as a systems administrator in the university CS department and continuing his work at agencies in New York City, San Diego, CA, and beyond. Darian has used Python and other technologies as a tool for web development, system administration tasks, statistics gathering, and everything in between. His career path began with Zope, then on to Plone, and then eventually, Flask, Django, and Pyramid.
Scott Sharkey is President of LANshark Consulting Group, LLC. in Troy, Ohio. He has a master's degree in computer science from Ohio State University and has been working in the industry since 1984, having founded LANshark in 1990. He specializes in remote work using Django/Python for web application development. During his long career, he has worked on projects as diverse as an in-car data collection system for IndyCar, TurboTax Pro for Intuit, two dating sites, an Internet of Things data collection application, several medical applications, and many other systems, along w ith publishing over 30 software packages through LANshark.
Packt is searching for authors like you
If you're interested in becoming an author for Packt, please visit authors.packtpub.com and apply today. We have worked with thousands of developers and tech professionals, just like you, to help them share their insight with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea.
Preface
The Django framework was specifically engineered to help developers construct robust, powerful web applications quickly and efficiently. It takes much of the tedious work and repetition out of the process, solving questions such as project structure, database object-relational mapping, templating, form validation, sessions, authentication, security, cookie management, internationalization, basic administration, and an interface to access data from scripts. Django is built upon the Python programming language, which itself enforces clear and easy-to-read code. Besides the core framework, Django has been designed to enable developers to create third-party modules that can be used in conjunction with your own apps. Django has an established and vibrant community where you can find source code, get help, and contribute.
Next page