Skip to main content

django-ajaxerrors

Simple Django middleware that makes it easy to view Django’s technical error page for failed AJAX requests by automagically opening them in a different browser window.

The Problem

I reckon most if not all Django developers know about Django’s useful debug-mode unhandled error page. However, when an AJAX request reaches a faulty view, the error page will not be rendered in your browser but instead be received by your AJAX error handler (assuming you even had one), which is almost always not what you want. This forces you you to find some other way to reach your traceback information. For example, before I wrote this package, I used to regularly open Chrome’s developer tools, find the failed resource in the Resources tab, and then either read through the raw HTML (yuck) or copy and paste it to a file and double click it (tedious).

Suggested Solution

Since the problem is really about ease of development, and since I (and I suspect many other Django developers) do most of my development work locally, I figured the solution can take advantage of the server being a full fledged desktop with a modern browser and a GUI. Enter ajaxerrors.middleware.ShowAJAXErrors. This little middleware intercepts all unhandled view exceptions, pickles the technical error page and uses Python’s webbrowser module to direct a new browser tab at a special URL that will serve (and delete) the previously stored page.

All this is only triggered if DEBUG is true and request.is_ajax() is true, so pretty much everything you’re used to in your development flow should stay the same. Sweet.

Installation Instructions

  1. Install like any other Python package with easy_install or pip, or simply with:

    python setup.py install

  2. Add ajaxerrors.middleware.ShowAJAXErrors to your MIDDLEWARE_CLASSES setting.

You can also find more info in the package’s readme file.

Contributing

django-ajaxerrors is licensed under the MIT license, see the LICENSE file in this distribution if you’re really interested in reading all them small letters.

I’d really like to see this as a feature in Django some day, but first we should see if other people are interested and maybe add more stuff to this really simple utility. Anyway, feel free fork away and send me pull requests. I’ll do my sane best to fix any bugs for as long as… well, at least until I lose interest.

If you’d like to discuss something about django-ajaxerrors or if you are otherwise curious about me, please find me at yaniv at aknin dot name, visit django-ajaxerrors’ GitHub page or my smashing Python-centric tech blog.

Metadata

Release files for django-ajaxerrors 1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-ajaxerrors 1.1
File Size Uploaded Provenance Actions
django-ajaxerrors-1.1.tar.gz 5.5 kB Without provenance Details for django-ajaxerrors-1.1.tar.gz

Release files / django-ajaxerrors-1.1.tar.gz

Download URL django-ajaxerrors-1.1.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
825d6457dc9213c8bb64f6eea31079053ca9321a70aa0b763397c87121457eea
BLAKE2b-256 checksum
How to use checksums
8082eff594f12a6a501bd861d53c5f440e44df5da2c63acf8070406a32b90f9e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for django-ajaxerrors 1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page