bottle-sessionbottle.py 插件

联合创作 · 2023-09-28

bottle.py 的一个插件,方便使用 session

from bottle import run, Bottle 
from beaker.middleware import SessionMiddleware
from bottle_session import Plugin

app = Bottle()
app.install(Plugin())

app.get('/hello')
def hello():
    # Access the session
    app.session['key']

session_opts = { 
    'session.type': 'file',
    'session.cookie_expires': 3600,
    'session.data_dir': '/tmp',
    'session.auto': True
}
app = SessionMiddleware(app, session_opts)

 

浏览 1
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报