Quixote (web框架)

本頁使用了標題或全文手工轉換
維基百科,自由的百科全書
Quixote
開發者Andrew Kuchling, Neil Schemenauer 和 Greg Ward
首次發佈2000年8月12日,​23年前​(2000-08-12[1][2]
目前版本
  • 3.6 (2022年6月23日)[3]
編輯維基數據連結
原始碼庫 編輯維基數據連結
程式語言Python
作業系統跨平台
類型Web應用框架
許可協定MIT許可證
網站quixote.ca 編輯維基數據連結

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

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)

參見[編輯]

參照[編輯]

  1. ^ CHANGES_24.txt. [2021-03-12]. (原始內容存檔於2020-01-19). 
  2. ^ Quixote頁面存檔備份,存於互聯網檔案館) is a web application framework developed and first released by the MNX in 2000 (or 2001).
  3. ^ Release 3.6. 2022年6月23日 [2022年10月26日]. 
  4. ^ The Quixote Web Framework. [2021-03-12]. (原始內容存檔於2022-02-02). 
  5. ^ Quixote: a Python-Centric Web Application Framework頁面存檔備份,存於互聯網檔案館), 22 July 2002, By Greg Ward, Linux Journal

外部連結[編輯]