Skip to main content

Raise any response object in Django

Project description


django-raise-response is a simple plugin that provides the ability to return any response by raising it as you would do with django.http.Http404

Why would you need this? If you need to return a non-4XX/5XX response from a class-based view, for example a 303/301 response, this is the only decent way to do it.


pip install django-raise-response

Then add ‘raiseresponse.middlewares.RaiseResponse’ to your middlewares:



Now you can use ResponseError to raise any response:

from raiseresponse import ResponseError

# somewhere in your view
response_you_want_to_rise = HttpResponse()
raise ResponseError(response_you_want_to_rise)

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-raise-response, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size django_raise_response-0.1.0-py3-none-any.whl (4.0 kB) File type Wheel Python version 3.6 Upload date Hashes View
Filename, size django-raise-response-0.1.0.tar.gz (2.0 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page