Skip to content

Instantly share code, notes, and snippets.

@Miserlou
Created March 10, 2014 22:22
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save Miserlou/9475753 to your computer and use it in GitHub Desktop.
Threaded PDB With Django
from django.http import HttpResponse, HttpResponseRedirect
from django.template import RequestContext
from django.shortcuts import get_object_or_404, render_to_response
import threading
import pdb
def threaded_pdb_example_page(request):
def debug(args, **kwargs):
request = args['request']
import pdb
pdb.set_trace()
t = threading.Thread(target=debug,
args=[request],
kwargs={'fail_silently': True})
t.setDaemon(True)
t.start()
return render_to_response('my_app/my_template.html',
{'success': True},
context_instance=RequestContext(request))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment