我有点迷路了。如何开始使用金字塔烧杯的python脚本。我更喜欢这样通过uwsgi调用它:
uwsgi -s :9001 --module script
但当我用curl调用它时
^{pr2}$在脚本.py就像这样
from beaker.middleware import SessionMiddleware
from pyramid.config import Configurator
def application(environ, start_response):
# Get the session object from the environ
session = environ['beaker.session']
start_response('200 OK', [('Content-type', 'text/plain')])
return ['returned']
# Configure the SessionMiddleware
session_opts = {
'session.type': 'file',
'session.cookie_expires': True,
}
#wsgi_app = SessionMiddleware(application, session_opts)
config = Configurator()
config.include('pyramid_beaker')
wsgi_app = SessionMiddleware(application, session_opts)
谢谢!在
不应将
SessionMiddleware
与pyramid_beaker
结合使用。Pyramid通过request.session
自动为session对象提供自己的接口。在uwsgi-s:9001模块脚本:wsgi_app在
是您需要的,否则uWSGI将调用“application”函数,跳过中间件
相关问题 更多 >
编程相关推荐