python. 500 ( , 200, ).
:
, , development.ini/production.ini , , , , .....
[formatter_generic]
format = y u no work??!!?? %(message)s
from pyramid.view import view_config
from webob import Response
import logging
log = logging.getLogger(__name__)
@view_config(route_name='home', renderer='templates/mytemplate.pt')
def my_view(request):
raise ValueError("oops")
return {'project':'tstLogError'}
@view_config(context=Exception)
def exception_view(context, request):
log.error("The error was: %s" % context, exc_info=(context))
return Response(status_int=500, body=str(context))
from pyramid.view import view_config
from webob import Response
:
serving on http://0.0.0.0:6543
y u no work??!!?? The error was: oops
Traceback (most recent call last):
File "/home/twillis/projects/TestLogError/local/lib/python2.7/site-packages/pyramid/tweens.py", line 20, in excview_tween
response = handler(request)
File "/home/twillis/projects/TestLogError/local/lib/python2.7/site-packages/pyramid/router.py", line 164, in handle_request
response = view_callable(context, request)
File "/home/twillis/projects/TestLogError/local/lib/python2.7/site-packages/pyramid/config/views.py", line 333, in rendered_view
result = view(context, request)
File "/home/twillis/projects/TestLogError/local/lib/python2.7/site-packages/pyramid/config/views.py", line 471, in _requestonly_view
response = view(request)
File "/home/twillis/projects/TestLogError/tstLogError/tstlogerror/views.py", line 8, in my_view
raise ValueError("oops")
ValueError: oops
