<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          pyGrowlerPython Web框架

          聯(lián)合創(chuàng)作 · 2023-09-20 07:20

           pyGrowler 是在PEP 3156和 Python 3.4 標(biāo)準(zhǔn)下,利用全新的異步庫開發(fā)的Web框架。受NodeJS擴(kuò)展庫的啟發(fā), pyGrowler也采用通過一系列的中間件來處理HTTP請求。同時,高可定制性的中間件對處理復(fù)雜的應(yīng)用程序極為方便。

          使用示例代碼:

          import asyncio
          
          from growler import App
          from growler.middleware import (Logger, Static, Renderer)
          
          loop = asyncio.get_event_loop()
          
          # Construct our application with name GrowlerServer
          app = App('GrowlerServer', loop=loop)
          
          # Add some growler middleware to the application
          app.use(Logger())
          app.use(Static(path='public'))
          app.use(Renderer("views/", "jade"))
          
          # Add some routes to the application
          @app.get('/')
          def index(req, res):
              res.render("home")
          
          @app.get('/hello')
          def hello_world(req, res):
              res.send_text("Hello World!!")
          
          # Create the server - this automatically adds it to the asyncio event loop
          Server = app.create_server(host='127.0.0.1', port=8000)
          
          # Tell the event loop to run forever - this will listen to the server's
          # socket and wake up the growler application upon each connection
          loop.run_forever()
          瀏覽 24
          點贊
          評論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報
          評論
          圖片
          表情
          推薦
          點贊
          評論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  国产AV探花 | 黄色片A片 | www婷婷| 日韩精品 A片视频 | 国产黄色电影一区 |