pyramid web框架

# -*- coding: utf-8 -*-
# by dl
from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from pyramid.response import Response

def hello_world(request):
    return Response('Hello World!')

if __name__ == '__main__':
    with Configurator() as config:
        #  路由名称 路径
        config.add_route('hello2', '/')
        # 执行的函数名,路由名称(需和上面一致)
        config.add_view(hello_world, route_name='hello2')
        app = config.make_wsgi_app()
    server = make_server('0.0.0.0', 6543, app)
    server.serve_forever()

 结合 cookiecutter 创建管理项目

https://docs.pylonsproject.org/projects/pyramid/en/latest/quick_tutorial/cookiecutters.html 

猜你喜欢

转载自blog.csdn.net/qq_35899407/article/details/88953724