Book Image

Learning Django Web Development

By : Sanjeev Jaiswal, Ratan Kumar
Book Image

Learning Django Web Development

By: Sanjeev Jaiswal, Ratan Kumar

Overview of this book

<p>Django, written in Python, is a web application framework designed to build complex web applications quickly without any hassle. It loosely follows the MVC pattern and adheres to the Don't Repeat Yourself principle, which makes a database-driven application efficient and highly scalable, and is by far the most popular and mature Python web framework.</p> <p>This book is a manual that will help you build a simple yet effective Django web application. It starts by introducing Django, setting it up, and shows you how to code simple programs. You will then learn to build your first Twitter-like app. Later on, you will be introduced to Hashtags, AJAX to enhance the user interface, and tweets. You will then move on to create an administration interface, learn database connectivity, and use third-party libraries. Then you will learn to debug and deploy Django projects, and also get a glimpse of Django with AngularJS and Elasticsearch. By the end of the book, you will be able to leverage the Django framework to develop a fully functional web application with minimal effort.</p>
Table of Contents (22 chapters)
Learning Django Web Development
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

IPDB – interactive way of busting bugs


Ipdb is an interactive source code debugger for Python programs.

Run the following command to install Ipdb:

$pip install ipdb

Ipdb is the interactive way of debugging Python application. After installing Ipdb, to use it in any function, just write the following code:

import ipdb;ipdb.set_trace()

This magical line will halt the whole Django execution at the point where this code is present, and will give you an active console, where you can find out the bugs or check the variable's value in real time.

The shortcuts for ipdb (when you are in the active console) are:

  • n: This refers to next

  • ENTER: This refers to repeat previous

  • q: This refers to quit

  • p <variable>: This is the print value

  • c: This refers to continue

  • l: This is the list where you are

  • s: This is to step into a subroutine

  • r: This means to continue till the end of the subroutine

  • ! <python command>: To run Python command inside the active console