Middleware

class middleware.TraceExtrasMiddleware(get_response)

Adds additional tracing information to current span

class middleware.MemoryUsageMiddleware(get_response)

Logs memory used before and after request is handled by the view. Prints out the memory usage and allocated by the view along with the url being requested.

get_memory() int

Resident Set Size - amount of memory in bytes used by current process

middleware.meg_context_processor(request)

Context processor that injects custom values to templates, such as settings:

NULL_PLACEHOLDER: str

Lazy-translated String used to represent null value in user interfaces (i.e. “-“). The value is set by settings.NULL_PLACEHOLDER and is expected to be a lazy-translated string.

browser_supported: bool

Tells whether the browser making the request is officially supported, or True if check is suppressed by SUPPRESS_BROWSER_CHECK.

cache_duration: int

default cache duration setting as set by CACHE_DURATION.

class middleware.AdminSecurityMiddleware(get_response)

Restricts super/global users with weak security from accessing admin site.

class middleware.MetadataMiddleware(get_response)

Add metadata to response headers

class middleware.CacheControlMiddleware(get_response)

Middleware processor to update response with cache-control header if they don’t have any. If this header is not there, it is set to no-cache so that django views won’t cache response.