I tried code from a tutorial in the PythonAnywhere help-pages:
In the information section, they explained that they need to see this code and paste it into the WSGI application file. After restarting it should indicate that the application is running.
Code
import tornado.web
import tornado.wsgi
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write("Hello from Tornado")
application = tornado.wsgi.WSGIApplication([
(r"/", MainHandler),
])
I tried to launch the web application written in Tornado on the PythonAnywhere service, expecting that I would succeed.
Application not running, error shown
However, after following all the instructions, the web application did not launch. Instead I see this error:
There was an error loading your PythonAnywhere-hosted site. There may be a bug in your code.
Error code: Unhandled Exception"
Question
Can you explain why the application launch failed? Maybe with an example of how to properly run an application using Tornado.