User Tools

Site Tools


devel:blueprints:refactor-mod-python-to-django

This is an old revision of the document!


Specification: https://blueprints.launchpad.net/nav/+spec/refactor-mod-python-to-django

Refactor mod_python based web apps to Django based

The mod_python project is dead, its recommended successor is mod_wsgi. Much of the legacy web apps in NAV interface directly with the mod_python API at a low level. These systems should all be refactored to be served through Django instead, so we can be independent of the actual low-lever web server technology being used. A separate blueprint for each mod_python-interfacing web app should be created, and this blueprint should be udpated to depend on all of those.

A typical mod_python handler in NAV

A mod_python handler is a Python module containing a function called handler(). The handler function takes a single argument, a mod_python request object. A typical handler in NAV code will examine the request object and return some output based on the request.

Often, the handler will include its own dispatch function - it performs varying actions based on the request's URI. The dispatch function often comes in the form of a giant if/elif/else construct, or, if you're lucky, it delegates each accepted URI pattern to a separate handler/view function.

devel/blueprints/refactor-mod-python-to-django.1299659777.txt.gz · Last modified: 2011/03/09 08:36 by morten