Stay organized with collections
Save and categorize content based on your preferences.
google.appengine.ext.ndb.django_middleware module
Summary
Django middleware for NDB.
Contents
- class google.appengine.ext.ndb.django_middleware.NdbDjangoMiddlewaresource
-
Bases: object
Django middleware for NDB.
To use NDB with django, add
‘ndb.NdbDjangoMiddleware’,
to the MIDDLEWARE_CLASSES entry in your Django settings.py file.
Or, if you are using the ndb version from the SDK, use
‘google.appengine.ext.ndb.NdbDjangoMiddleware’,
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.
See http://docs.djangoproject.com/en/dev/topics/http/middleware/.
- process_exception(unused_request, unused_exception)source
-
Called by Django when a view raises an exception.
- process_request(unused_request)source
-
Called by Django before deciding which view to execute.
- process_response(request, response)source
-
Called by Django just before returning a response.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-04-04 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-04-04 UTC."],[[["The `NdbDjangoMiddleware` class is Django middleware designed for use with NDB."],["To integrate NDB with Django, add either `'ndb.NdbDjangoMiddleware'` or `'google.appengine.ext.ndb.NdbDjangoMiddleware'` to the `MIDDLEWARE_CLASSES` in your `settings.py` file."],["It is recommended to position this middleware ahead of other middleware classes to ensure proper handling of datastore calls."],["`NdbDjangoMiddleware` provides methods like `process_request`, `process_response`, and `process_exception` to interact with the Django request-response cycle."]]],[]]