Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

33 lines (20 sloc) 0.798 kb


If you've got a large number of includes in your Django, then there can be a performance hit in accessing urls at the bottom of the includes as Django searches through multiple url patterns to find the match.

This monkey patches URLResolvers so that when the right pattern is found we cache that pattern and move it to the top of the url pattern stack so it will be found quicker.

In completely unscientific tests on one site, before:

Requests per second: 438.49 [#/sec] (mean)


Requests per second: 585.39 [#/sec] (mean)


  1. Install from pypi:

    pip install django-include-cache

  2. In (or your wsgi script) add:

    import include_cache

Author: Andy McKay

Jump to Line
Something went wrong with that request. Please try again.