Top "Django-middleware" questions

Middleware is a framework of hooks into Django’s request/response processing.

Python and Django OperationalError (2006, 'MySQL server has gone away')

Original: I have recently started getting MySQL OperationalErrors from some of my old code and cannot seem to trace back …

python mysql django nginx django-middleware
How to set up custom middleware in Django

I am trying to create middleware to optionally pass a kwarg to every view that meets a condition. The problem …

python django django-views django-middleware
Forbidden (403) CSRF verification failed. Request aborted

I am making an app of login form but when I am running my app and click on login button …

django django-views django-middleware
Django exception middleware: TypeError: object() takes no parameters

I'm using Django 1.10 and trying to catch all exceptions with exception middleware. The code below causes an internal server error: …

django django-middleware
Django: "No module named context_processors" error after reboot

I have a Django site that works on my PC, and was working briefly on my server after loading it …

python django django-settings django-middleware
Django: WSGIRequest' object has no attribute 'user' on some pages?

I want to set a cookie if user is logged in or not. My middleware: class UserStatus(object): def process_…

python django wsgi django-middleware
Where to put Django startup code?

I'd like to have these lines of code executed on server startup (both development and production): from django.core import …

python django django-middleware
How to return an rest_framework.response object from a django custom middleware class?

I am trying to write a middleware class that ensures that the user is logged in. But the problem is …

django django-rest-framework django-middleware
'WSGIRequest' object has no attribute 'user'

I'am trying to make an auth module in my django project. But when I open my web site url I …

django django-middleware
Change Django Templates Based on User-Agent

I've made a Django site, but I've drank the Koolaid and I want to make an IPhone version. After putting …

python django django-templates mobile-website django-middleware