CARVIEW |
Select Language
HTTP/2 200
date: Sat, 11 Oct 2025 23:01:04 GMT
content-type: text/html; charset=utf-8
cross-origin-opener-policy: same-origin
nel: {"report_to":"heroku-nel","response_headers":["Via"],"max_age":3600,"success_fraction":0.01,"failure_fraction":0.1}
referrer-policy: same-origin
report-to: {"group":"heroku-nel","endpoints":[{"url":"https://nel.heroku.com/reports?s=kb6gwi7ChsX%2Fa2c%2BHebSNdDLYMF8Lj8O1WjwlGXJngM%3D\u0026sid=af571f24-03ee-46d1-9f90-ab9030c2c74c\u0026ts=1760223664"}],"max_age":3600}
reporting-endpoints: heroku-nel="https://nel.heroku.com/reports?s=kb6gwi7ChsX%2Fa2c%2BHebSNdDLYMF8Lj8O1WjwlGXJngM%3D&sid=af571f24-03ee-46d1-9f90-ab9030c2c74c&ts=1760223664"
server: cloudflare
strict-transport-security: max-age=15552000; includeSubDomains; preload
vary: Cookie
via: 1.1 heroku-router
x-content-type-options: nosniff
cf-cache-status: DYNAMIC
content-encoding: gzip
set-cookie: csrftoken=HOgm4HGmQmHryiVFFwOslFPsXJbhljaE; SameSite=Lax; Path=/; Max-Age=31449600; Expires=Sat, 10 Oct 2026 23:01:04 GMT
cf-ray: 98d1fa2b08181c71-BOM
alt-svc: h3=":443"; ma=86400
djangosnippets: server with debugging backdoor
server with debugging backdoor
this starts up two servers - HTTP serving the django application on port 8000 and a port 8001 server that will start an interactive interpreter with any incoming connections. this enables you to have an interpreter in the same process as your server.
$ wget https://localhost:8000/someurl/
(...)
$ nc localhost 8001
Python 2.5.2 (r252:60911, Jul 8 2008, 21:21:10)
[GCC 4.3.1 20080626 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from django.db import connection
>>> connection.queries
[ ... ]
1 2 3 4 5 6 7 8 9 10 11 12 | #!/usr/bin/env python
import os
from django.core.handlers.wsgi import WSGIHandler
from eventlet import api, backdoor, wsgi
os.environ["DJANGO_SETTINGS_MODULE"] = "settings"
api.spawn(api.tcp_server, api.tcp_listener(("127.0.0.1", 8001)), backdoor.backdoor)
wsgi.server(api.tcp_listener(("127.0.0.1", 8000)), WSGIHandler())
|
More like this
- Add Toggle Switch Widget to Django Forms by OgliariNatan 1 month ago
- get_object_or_none by azwdevops 4 months, 3 weeks ago
- Mask sensitive data from logger by agusmakmun 6 months, 3 weeks ago
- Template tag - list punctuation for a list of items by shapiromatron 1 year, 8 months ago
- JSONRequestMiddleware adds a .json() method to your HttpRequests by cdcarter 1 year, 9 months ago
Comments
This is ridiculously cool, but is there an advantage to doing it like this over just using "./manage.py shell"? Django servers don't really have any global state, so I'm not sure how useful it is being able to operate in the same process as the server itself.
#
Please login first before commenting.