Quixote (web框架)

来自维基百科,自由的百科全书

Quixote是一個使用Python開發web應用軟體框架。Quixote是「基於了簡單的、靈活的設計,使得可以快速的書寫應用,並受益於廣泛的可獲得的第三方Python模組。」[4]

快速預覽 開發者, 首次發布 ...
Quixote
開發者Andrew Kuchling, Neil Schemenauer 和 Greg Ward
首次發布2000年8月12日,​24年前​(2000-08-12[1][2]
目前版本3.3(2021年1月25日,​4年前​(2021-01-25[3]
原始碼庫 編輯維基數據鏈結
程式語言Python
作業系統跨平台
類型Web應用框架
許可協定MIT許可證
網站quixote.python.ca 編輯維基數據鏈結
關閉

Quixote應用典型的是個Python包,即組織入一個單一的目錄樹中的一組模組。Quixote接著對映一個URL至這個Python包內的一個函式方法;接著用這個HTTP請求的內容來呼叫這個函式,並將結果返回給客戶端

演示代碼

最小的Quixote演示程式。在安裝了quixote包之後,可以如下這樣執行它:$ python demo/mini_demo.py。這個伺服器預設的監聽localhost:8080。除錯和錯誤輸出會傳送到終端。

from quixote.publish import Publisher
from quixote.directory import Directory, export

class RootDirectory(Directory):
    @export(name='')
    def index(self):
        return '''<html>
                    <body>Welcome to the Quixote demo.  Here is a
                    <a href="hello">link</a>.
                    </body>
                  </html>
               '''
    @export
    def hello(self):
        return '<html><body>Hello world!</body></html>'

def create_publisher():
    return Publisher(RootDirectory(),
                     display_exceptions='plain')

if __name__ == '__main__':
    from quixote.server.simple_server import run
    print('creating demo listening on http://localhost:8080/')
    run(create_publisher, host='localhost', port=8080)

參見

參照

外部連結

Loading related searches...

Wikiwand - on

Seamless Wikipedia browsing. On steroids.