Example #1
0
                                           "templates"),
                static_path=os.path.join(os.path.dirname(__file__), "static"),
                xsrf_cookies=False,
                login_url="/login",
                host=options.host,
                port=options.port,
                debug=options.debug,
                cookie_secret=str(options.debug or uuid.uuid1().hex),
                session_secret=str(options.debug or uuid.uuid4().hex),
                encrypt_url="encrypt.wutong.com",
                ui_modules={
                    "MyModule": MyModule,
                },
                ui_methods={
                    "encodestr": lambda handler, x: util.encodestr(x),
                    "str2datetime": lambda handler, x: util.str2datetime(x),
                    "prettytime": lambda handler, x: util.prettytime(x),
                },
                dsn="dbname=%s user=%s password=%s host=%s port=%s" % (
                    options.dbname,
                    options.dbuser,
                    options.dbpasswd,
                    options.dbhost,
                    str(options.dbport),
                ))
settings['upload_path'] = os.path.join(settings['static_path'], "uploads")
settings['avatar_path'] = os.path.join(settings['static_path'], "avatar")

Session.register(settings["session_secret"])
lib.util.encrypt_url = settings.get("encrypt_url")