django-debug-request
It’s cURL in your Django! This is a very small and light-weight alternative to something like django-debug-toolbar that is useful to use in production when you need to figure out what is going wrong. It consists of one management command that supports limited subsect of the cURL command’s arguments, but executes the request inside the Django stack using django.test.client.Client – with extended debug output.
Tested with Django 4.2 and 5.0.
Installation
First, install the package:
pip install django-debug request
Then, add it to your installed apps:
INSTALLED_APPS = [
…
"django_debug_request",
]
That’s it!
Usage
Use your app in production and choose “Copy to cURL” in your browser’s developer tools for the request you are interested in. Replace curl with python manage.py debug_request and run it against your server.
Supported cURL options:
-X/--method
-H/--header
-data-raw
--compressed (will be ignored since you probably do not like compressd output, but is supported for compatibility with cURL lines generated by Chrome)
Supported other options
--print-sql Log all SQL queries
Example:
$ python manage.py debug_request https://localhost/admin/login/
DEBUG 2024-05-01 09:03:15,790 debug_request debug_request Extra array: {'HTTP_HOST': 'localhost'}
DEBUG 2024-05-01 09:03:15,805 debug_request debug_request Response code: 200
DEBUG 2024-05-01 09:03:15,805 debug_request debug_request Resolver match: ResolverMatch(func=django.contrib.admin.sites.login, args=(), kwargs={}, url_name='login', app_names=['admin'], namespaces=['admin'], route='admin/login/')
DEBUG 2024-05-01 09:03:15,805 debug_request debug_request Response header: Content-Type: text/html; charset=utf-8
DEBUG 2024-05-01 09:03:15,805 debug_request debug_request Response header: Expires: Wed, 01 May 2024 09:03:15 GMT
DEBUG 2024-05-01 09:03:15,805 debug_request debug_request Response header: Cache-Control: max-age=0, no-cache, no-store, must-revalidate, private
DEBUG 2024-05-01 09:03:15,805 debug_request debug_request Response header: Vary: Cookie
DEBUG 2024-05-01 09:03:15,805 debug_request debug_request Response header: X-Frame-Options: DENY
DEBUG 2024-05-01 09:03:15,805 debug_request debug_request Response header: Content-Length: 4145
DEBUG 2024-05-01 09:03:15,805 debug_request debug_request Response header: X-Content-Type-Options: nosniff
DEBUG 2024-05-01 09:03:15,805 debug_request debug_request Response header: Referrer-Policy: same-origin
DEBUG 2024-05-01 09:03:15,806 debug_request debug_request Response header: Cross-Origin-Opener-Policy: same-origin
<html>
…
License
Apache License
Metadata
Release files for django-debug-request 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django_debug_request-1.0.0.tar.gz | 9.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_debug_request-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.0 kB
Release files / django_debug_request-1.0.0.tar.gz
| Download URL | django_debug_request-1.0.0.tar.gz |
|---|---|
| Size | 9.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
267172e138c6d6be95a1cd11438b17018eb4ed5b3015d305898c862d1d35b775
|
|
BLAKE2b-256 checksum How to use checksums |
1317ee71258a6ece96bf98973dfd0a811945857003258395d020a8f033b6bfbe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.8
|
Release files / django_debug_request-1.0.0-py3-none-any.whl
| Download URL | django_debug_request-1.0.0-py3-none-any.whl |
|---|---|
| Size | 8.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
310ce979ac7f39459040ac2e64d7921e7d0158c954f31b6ae2c4cbf226645ef1
|
|
BLAKE2b-256 checksum How to use checksums |
bf2770f93f55aff2676e4cace199875e3dc5aa3e61b5128168365f54f901fcf2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.8
|