How do I profile django application using django web profiler

When working with a large scale applications which includes many modules, we need to focus on the performance to give more user statisfaction, sustainability. To improve the performance, we need to analyze the application in various cases for ex: examine all urls with their response time and status codes, no of database queries with time, no of cache hits for a particural url.

In that case, django-web-profiler will be very helpful for your application. It'll records the application urls with data such as response time, status code, database queries, time taken to execute those queries, no of cache hits.

A django profiling tool which logs, stores debug toolbar statistics and also a set of URL’s statistics using a management command. It logs request values such as device, ip address, user cpu time, system cpu time, No of queries, sql time, no of cache calls, missing, setting data cache calls for a particular url.

It also provides a basic UI, which will differentiate development url statistics, production level statistics which generates using a management command.

How to setup for a django application?

Install django-web-packer using the following command:

  pip install django-web-profiler
  git clone git://
  cd django-web-profiler
  python install

Add app name in


Add ‘django_web_profiler.middleware.DebugLoggingMiddleware’ to your project middlewares:


Disable ‘debug_toolbar.middleware.DebugToolbarMiddleware’ if you’ve already using it.
Make sure that ‘debug-toolbar’ has enabled for your application. After installing debug toolbar, add the following details to

    INTERNAL_IPS = (‘’,)

After installing/cloning, add the following details in settings file about urls, logger names:

    URLS = ['', '']

Add the following logger to your existing loggers and create a folder called ‘logs’ where all profiler log files are stored:

    'request-logging': {

        'level': 'DEBUG',

        'handlers': ['console', 'file_log'],

        'propagate': False,


Here file_log is a handler which contains a path where log files are stored.

Sample Application

Install application requirements using the following command:

  pip install -r requirements.txt

Load the application load using the following command:

  python sandbox/ loaddata sandbox/fixtures/users.json

Using the following command, we can generate url statistics in production environment i.e debug=False:

  python sandbox/ logging_urls

We are always looking to help you customize the whole or part of the code as you like.

Visit our Django Development page Here

We welcome your feedback and support, raise github ticket if you want to report a bug. Need new features? Contact us here

Source Code is available in Micropyramid Repository(

Posted On 23 June 2018 By MicroPyramid

Need any Help in your Project?Let's Talk

Latest Comments
How do I profile django application using django web profiler

When working with a large scale applications which includes many modules, we need to focus on the performance to give more user statisfaction, sustainability. To …

Continue Reading...
Multifactor Authentication with Django MFA using Google Authenticator

Use Django Multi-Factor Authentication method to verify user identity with more than one authentication methods. It can be used for user login, any transactional methods …

Continue Reading...
Celery Flower to monitor task queue

Celery is a task queue that is to built an asynchronous message passing system. It can be used as a bucket where programming tasks can …

Continue Reading...
Check test coverage in Django code with Coveralls

Coverage: It is a tool used for measuring the effectiveness of tests, showing the percentage of your codebase covered by tests.
Test Coverage is an important …

Continue Reading...
Full text search in mongodb

Full text search is a custom implementation created by the MongoDB developers as a specific index type

Full text search as an index type when …

Continue Reading...
MongoDB CRUD operations with Python (Pymongo)

MongoDB with Python - Connection establishment, Create, Update, Retrieve and Delete operations explained with sample code.

Continue Reading...
Advanced Querying in MongoDB

Advanced Queries of MongoDB: Inserting records to the database and retrieving data from database.
1. Wrapped Queries: Like, sort, limit, count.
2. Query Using Modifiers: set, increment, …

Continue Reading...

The group() command, Aggregation Framework and MapReduce are collectively aggregation features of MongoDB. group(): Group Performs simple aggregation operations on a collection documents. Group is …

Continue Reading...

Subscribe To our news letter

Subscribe and Stay Updated about our Webinars, news and articles on Django, Python, Machine Learning, Amazon Web Services, DevOps, Salesforce, ReactJS, AngularJS, React Native.
* We don't provide your email contact details to any third parties