def parse_config_options(args=None):
    args = args or sys.argv[:]

    define("debug", default=False, help="enable autoreload for tornado web apps", type=bool)

    define("port", default=8888, help="tornado listen port", type=int)

    define("cookie_secret", default=randchars(32), help="cookie hash secret")

    define("mongodb", default="localhost:27017", help="mongodb host:port")

    define("smtp", default="localhost:25", help="smtp server")

    if len(args) >= 2 and os.path.exists(args[1]):
        tornado.options.parse_config_file(args[1])
        del args[1]

    # parse the remaining command line arguments
    # should override config file settings

    tornado.options.parse_command_line(args)
Esempio n. 2
0
 def set_password(self, password):
     self.salt = unicode(randchars(32))
     self.password = unicode(sha256(password + self.salt).hexdigest())