Book Image

Django Design Patterns and Best Practices - Second Edition

By : Arun Ravindran
Book Image

Django Design Patterns and Best Practices - Second Edition

By: Arun Ravindran

Overview of this book

Building secure and maintainable web applications requires comprehensive knowledge. The second edition of this book not only sheds light on Django, but also encapsulates years of experience in the form of design patterns and best practices. Rather than sticking to GoF design patterns, the book looks at higher-level patterns. Using the latest version of Django and Python, you’ll learn about Channels and asyncio while building a solid conceptual background. The book compares design choices to help you make everyday decisions faster in a rapidly changing environment. You’ll first learn about various architectural patterns, many of which are used to build Django. You’ll start with building a fun superhero project by gathering the requirements, creating mockups, and setting up the project. Through project-guided examples, you’ll explore the Model, View, templates, workflows, and code reusability techniques. In addition to this, you’ll learn practical Python coding techniques in Django that’ll enable you to tackle problems related to complex topics such as legacy coding, data modeling, and code reusability. You’ll discover API design principles and best practices, and understand the need for asynchronous workflows. During this journey, you’ll study popular Python code testing techniques in Django, various web security threats and their countermeasures, and the monitoring and performance of your application.
Table of Contents (21 chapters)
Title Page
Copyright and Credits
PacktPub.com
Contributors
Preface
Index

Other debuggers


There are several drop-in replacements for pdb. They usually have a better interface. Some of the console-based debuggers are as follows:

  • ipdb: Like IPython, this has autocomplete, syntax-colored code, and so on.
  • pudb: Like old Turbo C IDEs, this shows the code and variables side by side.
  • IPython: This is not a debugger. You can get a full IPython shell anywhere in your code by adding the from IPython import embed; embed() line.

pudb is my preferred replacement for pdb. It is so intuitive that even beginners can easily use this interface. Like pdb, just insert the following code to break the execution of the program:

import pudb; pudb.set_trace() 

When the preceding line is executed, a full-screen debugger is launched, as shown here:

A typical pudb debugging session

Press the ? key to get help on the complete list of keys that you can use.

Additionally, there are several graphical debuggers, some of which are stand alone, such as winpdb and others, which are integrated to the IDE...