Mapping routes

Author:Etienne Robillard <>
Last modified:2017-01-23

What is it

A replacement for the django.core.urlresolvers package. The replacement should be backward-compatible with Django.

How does it work

The class notmm.utils.urlmap.RegexURLMap provides a simple wrapper to group distinct urls to logical groups using the add_routes method. This method can be called a number of times to provide a elegant yet robust way to separate urls in distinct categories.

from notmm.utils.urlmap import RegexURLMap
urlpatterns = RegexURLMap()
    (r'^register.php$', 'example_exploit', {}),
    (r'^index.php$', 'poo_callback', {}),

It should also be noted that you can also call urlpatterns.include(someobj) to include another urls module.

from notmm.utils.urlmap import RegexURLMap

from django.contrib import admin

urlpatterns = RegexURLMap(label="django admin")


The purposes of the notmm.utils.urlmap module are for educational and artistic uses only. While searching for a simple way to reorganize urls within a file, I found the URLMap replacement an easy way to categorize contents by splitting large urlpatterns objects in smaller size datastructures.


To upgrade from standard Django urlpatterns to notmm.utils.urlmap.RegexURLMap, change the line

from django.conf.urls.defaults import *


from notmm.utils.urlmap import RegexURLMap, include

Then you should define a default urlpatterns instance or upgrade the previous one to the RegexURLMap API. You can also at this point add new endpoints (packages) using the add_routes method.


  • More tests is needed for interoperability with Django 1.3, 1.4
  • Allow urlmap.URLMap to fetch urlpatterns objects from a backend db.
  • Integration with webdav, to allow saving and deletion of urlpatterns
  • Make a separate urlmap package for easier access to the programming interfaces.

Table Of Contents

Previous topic

Schevo Storage API

This Page