Django Gunicorn Debug
Ok I've recently stumbed upon similar problem. I wasn't able to apply @dudklein solution (I get I/O Errors while debugger was trying to take input - ipdb, pdb etc.)
I used remote python debbuger - winpdb and it's embedded debugging.
install winpdb in Your virtualenv
pip install winpdb
import and run embedded debugger in Your code:
import rpdb2rpdb2.start_embedded_debugger('pass')
run gunicorn with --timeout argument
gunicorn -t 3600 env:application
run proper view using browser eg.
http://127.0.0.1:8000/your-view/
connect to embedded debugger using winpdb:
winpdb -a /path/to/django/app/views.py
It will prompt You for a password (use one You set in Your code, in my example it is 'pass') and run nice GUI with debugger.
if You need tutorial for
winpdb
- here You are.
If you are able to launch gunicorn pointing at an application
instance that is an instance of the DebuggedApplication
class from the werkzeug
library, you will be able to set break points using the werkzeug debugger with import ipdb; ipdb.set_trace()
right in your browser.
import django.core.handlers.wsgifrom werkzeug.debug import DebuggedApplicationapplication = django.core.handlers.wsgi.WSGIHandler()application = DebuggedApplication(application, evalex=True)
Make sure you install werkzeug library and ipdb of course. (pip install werkzeug
and pip install ipdb
)