I would like to have a Python script that start the Tornado. I would like to like to enable auth only on the production stage and disable auth during development stage.
# This is the main page handler
class MainPageHandler(BaseHandler):
def get(self):
if not self.get_current_token():
self.redirect(self.reverse_full_url("tokenLogin"))
return
self.render('index.html')
# This is the main tornado app
class Application(tornado.web.Application):
def __init__(self, disableAuth=False):
...
# This is running in main function
Application(disableAuth).listen(PORT, HOST)
Would it be possible that I could switch on/off auth using python argument? An example would be very very nice.
Thanks in advance
Currently I would use a global flag (a flag in the config file) to take care of passing the variable around.