Search code examples
djangodjango-piston

Django-piston make piston return full traceback of exception


How to make piston return full traceback of exception. By default it returns me only last error text. Like

id() takes exactly one argument (0 given)

Need to know which file and which line...


Solution

  • Piston loads a http status response via utils.rc, no errors are raised.

    from the documentation:

    Configuration variables
    Piston is configurable in a couple of ways, which allows more granular 
    control of some areas without editing the code.
    
    Setting                         Meaning
    settings.PISTON_EMAIL_ERRORS    If (when) Piston crashes, it will email the 
                                    administrators a backtrace (like the Django one
                                    you see during DEBUG = True)
    settings.PISTON_DISPLAY_ERRORS  Upon crashing, will display a small backtrace 
                                    to the client, including the method signature 
                                    expected.
    settings.PISTON_STREAM_OUTPUT   When enabled, Piston will instruct Django to 
                                    stream the output to the client, but please read
                                    streaming before enabling it.
    

    I'd recommend to setup a logger, sentry together with raven is rather convenient and you get to configure your own log level and handler.