Skip to Content
Python 技術手冊 第三版
book

Python 技術手冊 第三版

by lex Martelli, Anna Martelli Ravenscroft, Steve Holden
January 2018
Intermediate to advanced
856 pages
17h 17m
Chinese
GoTop Information, Inc.
Content preview from Python 技術手冊 第三版
635
20
HTTP 網路服務
當一個瀏覽器(browser,或任何其他的 web 客戶端)向一個伺服器
server)請求一個頁面(page),伺服器可能會回傳靜態或動態的內容。
動態內容的提供,需要伺服端 web 程式設計師即時產生並遞送內容,通常
是基於儲存在資料庫中的資訊。
web 的史前時代,伺服端程式設計的標準是
CGI
Common Gateway
Interface),它要求伺服器每次接收到客戶端請求動態內容時都要執行一個
個別的程式。行程起始時間、直譯器的初始化、連接資料庫,以及指令稿
script)的初始化,這些加起來是不小的額外負擔(overhead)。因此,
CGI 並不容易拓展規模。
今日,web 伺服器支援許多伺服器專用的方式來減低額外負擔,從能夠服
務多個請求的行程提供動態內容,而非為每個請求都啟動一個新的 CGI
程。因此,我們沒有在本書中涵蓋 CGI。要維護既存的 CGI 程式,或將它
們移植到更現代的做法,請參閱標準程式庫模組
cgi
https://docs.python.
org/3/library/cgi.html
)和
http.cookies
https://docs.python.org/3/library/http.
cookies.html
)的線上文件
1
1 CGI 有遺留下來的一個傳統:當時伺服器主要是透過作業系統的環境(在 Python 中,
那是
os.environ
)提供要服務的 HTTP 請求之相關資訊給 CGI 指令稿,直到今日,web
伺服器和應用程式框架之間的介面還是仰賴「一個環境」 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

利用 Python 进行数据分析(原书第2版)

利用 Python 进行数据分析(原书第2版)

Wes McKinney

Publisher Resources

ISBN: 9789864766819