Ticket #4891: modpython.diff
File modpython.diff, 1.8 KB (added by , 17 years ago) |
---|
-
docs/modpython.txt
78 78 You can also add directives such as ``PythonAutoReload Off`` for performance. 79 79 See the `mod_python documentation`_ for a full list of options. 80 80 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. 81 Note that you should set ``PythonDebug Off`` on a production 82 server. If you leave ``PythonDebug On``, your users would see ugly 83 (and revealing) Python tracebacks if something goes wrong within 84 mod_python. For debugging errors on mod_python level, you can switch 85 on cgitb by using:: 84 86 87 PythonHandler django.core.handlers.modpython::handler_cgitb 88 85 89 Restart Apache, and any request to /mysite/ or below will be served by Django. 86 90 Note that Django's URLconfs won't trim the "/mysite/" -- they get passed the 87 91 full URL. -
django/core/handlers/modpython.py
174 174 return 0 # mod_python.apache.OK 175 175 176 176 def handler(req): 177 """ 178 Default Handler: 179 PythonHandler django.core.handlers.modpython 180 """ 177 181 # mod_python hooks into this function. 178 182 return ModPythonHandler()(req) 183 184 def 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