橡胶抛光轮,车恩杰,兄弟2820
in this blog, i will tell you how to use pyramid by codes.
''' the start point is the configurator class.use it to configure the routes and views, give application back to wsgi server finally. the class configurator inherits many classes.it is a big mix and has great power. ''' from wsgiref.simple_server import make_server from pyramid.config import configurator from pyramid.response import response def hello(request): return response("this is my small application") def page(request): return response("this is another page") def main(): config = configurator() config.add_route('hello', '/') config.add_route('test','/test') config.add_route(name="page",pattern="/page",view=page) config.scan('view') config.add_view(view=hello,route_name="hello") app = config.make_wsgi_app() return app if __name__ == '__main__': app = main() server = make_server('127.0.0.1', 8080, app) print ('starting up server on https://localhost:8080') server.serve_forever()
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
Python 实现将numpy中的nan和inf,nan替换成对应的均值
python爬虫把url链接编码成gbk2312格式过程解析
网友评论