Python Django

From Tmplab
Revision as of 23:13, 4 November 2010 by Phil (talk | contribs) (New page: = Debugging django = passenger_wsgi.py {{{ #!/usr/bin/python import sys, os f=open("/tmp/djangodebug", "w+") f.flush() sys.stderr = f try: import sys, os sys.path.append(os.get...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Debugging django

passenger_wsgi.py

{{{

  1. !/usr/bin/python

import sys, os f=open("/tmp/djangodebug", "w+") f.flush() sys.stderr = f

try:

   import sys, os
   sys.path.append(os.getcwd())
   os.environ['DJANGO_SETTINGS_MODULE'] = "XXX"
   import django.core.handlers.wsgi
   application = django.core.handlers.wsgi.WSGIHandler()

except:

   f.flush()
   print "Unexpected error:", sys.exc_info()[0]
   f.write('------------------------------')
   f.write(sys.exc_info()[0])
   f.write('------------------------------')
   f.close()

}}}