google.appengine.ext.ndb.django_middleware module


Django middleware for NDB.


class google.appengine.ext.ndb.django_middleware.NdbDjangoMiddlewaresource

Bases: object

Django middleware for NDB.

To use NDB with django, add


to the MIDDLEWARE_CLASSES entry in your Django file. Or, if you are using the ndb version from the SDK, use


It's best to insert it in front of any other middleware classes, since some other middleware may make datastore calls and those won't be handled properly if that middleware is invoked before this middleware.


process_exception(unused_request, unused_exception)source

Called by Django when a view raises an exception.


Called by Django before deciding which view to execute.

process_response(request, response)source

Called by Django just before returning a response.

Send feedback about...

App Engine standard environment for Python