Improviments

1st change:
before :
>>class SignupHandler(tornado.web.RequestHandler):
now:
>>class SignupHandler(BaseHandler):
because now is used a class(inheritance concpet):
>>class BaseHandler(tornado.web.RequestHandler):

2nd change:
separated a function, in other classe, because this make a clear code;

3rd change:
separate the settings and handlers from the application main function;