Tornado returning stacktrace on 500 server error

Viewed 130

I have made an application in Tornado that simple handles some REST api.

This is the code

class Application(tornado.web.Application):
def __init__(self):
    handlers = [
        ("/datasets/add", DatasetAdd),
        ("/projects/create", ProjectCreate),
        ("/scenarios/execute", ExecuteScenario)
    ]
    tornado.web.Application.__init__(self, handlers, debug=False)


def start():
    port = config['SERVER_PORT']
    num_processes = config['SERVER_NUM_PROCESSES']
    logging.info("Starting server on port {} using {} process ...".format(port, num_processes))
    app = Application()
    if sys.platform == 'win32':
        logging.warning('Running on Windows is not officially supported and is recommended only for            development use')

server = tornado.httpserver.HTTPServer(app)
server.bind(port, address='127.0.0.1')
if sys.platform == 'win32' and num_processes > 1:
    num_processes = 1  # fork process is not supported on Windows

server.start(num_processes)  # forks NUM process per cpu
logging.info("Server started.")
logging.info("Waiting for requests ...")
IOLoop.current().start()
logging.info('Server stopped.')

When I make a call to scenarios/execute, for example, it returns a

<html>
<title>500: Internal Server Error</title>

<body>500: Internal Server Error</body>

</html>

... but I want it to return the full stack trace for the error to the caller (it is Python code executed in same project...)

How can I do?

0 Answers
Related