金字塔烧杯和uwsgi入门

2024-05-14 18:24:38 发布

您现在位置:Python中文网/ 问答频道 /正文

我有点迷路了。如何开始使用金字塔烧杯的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)

谢谢!在


Tags: thefromimport脚本pyramidconfigapplicationsession

热门问题