def setup_app() -> (SessionMiddleware, int, bool):
bottle.debug(True)
p = get_config(section='api', key='port', default=5080)
bottle.install(error_translation)
session_opts = {
'session.cookie_expires': True,
'session.encrypt_key': get_config('api', 'encrypt_key', 'softfire'),
'session.httponly': True,
'session.timeout': 3600 * 24, # 1 day
'session.type': 'cookie',
'session.validate_key': True,
}
a = SessionMiddleware(bottle.app(), session_opts)
qb = get_config('api', 'quiet', 'true').lower() == 'true'
logger.debug("Bootlepy quiet mode: %s" % qb)
return a, p, qb
评论列表
文章目录