Ticket #4891: modpython.diff

File modpython.diff, 1.8 KB (added by Thomas Güttler <hv@…>, 17 years ago)
  • docs/modpython.txt

     
    7878You can also add directives such as ``PythonAutoReload Off`` for performance.
    7979See the `mod_python documentation`_ for a full list of options.
    8080
    81 Note that you should set ``PythonDebug Off`` on a production server. If you
    82 leave ``PythonDebug On``, your users would see ugly (and revealing) Python
    83 tracebacks if something goes wrong within mod_python.
     81Note that you should set ``PythonDebug Off`` on a production
     82server. If you leave ``PythonDebug On``, your users would see ugly
     83(and revealing) Python tracebacks if something goes wrong within
     84mod_python. For debugging errors on mod_python level, you can switch
     85on cgitb by using::
    8486
     87        PythonHandler django.core.handlers.modpython::handler_cgitb
     88
    8589Restart Apache, and any request to /mysite/ or below will be served by Django.
    8690Note that Django's URLconfs won't trim the "/mysite/" -- they get passed the
    8791full URL.
  • django/core/handlers/modpython.py

     
    174174        return 0 # mod_python.apache.OK
    175175
    176176def handler(req):
     177    """
     178    Default Handler:
     179    PythonHandler django.core.handlers.modpython
     180    """
    177181    # mod_python hooks into this function.
    178182    return ModPythonHandler()(req)
     183
     184def handler_cgitb(req):
     185    """
     186    CGI Trackback Handler:
     187    PythonHandler django.core.handlers.modpython::handler_cgitb
     188    """
     189    import cgitb
     190    try:
     191        handler(req)
     192    except:
     193        req.content_type = 'text/html'
     194        cgitb.Hook(file = req).handle()
     195    return 0 # mod_python.apache.OK
     196   
Back to Top