標籤:
問題
web framework是否包括webserver? 是否可以包括?
webserver 和 framework的關係是?
https://www.quora.com/What-is-the-difference-between-a-web-server-and-a-web-framework
A web server is an executable that handle http requests and serve your files to the client.
A lot of web frameworks have a web server executable so you can test your code easily, but usually these web servers are for developer only. It means that you shouldn‘t use them for production, since they are not safe at all.
web server
A web server listens for web connections and either serves static content from files, or passes requests onto other code.
伺服器服務靜態內容, 傳送請求到其它代碼中, CGI程式中(CGI程式實現 framework)。
web framework
Originally, the "passing on" meant executing programs (usually scripts) separate from the WS, using a protocol called CGI (just a standard way to describe call the script, communicating the request, who it came from, etc.) Script libraries, for parsing CGI requests, or generating HTML became the first web frameworks.
實現CGI協議的程式, 指令碼庫, 解析CGI請求, 產生HTML, 這個編程了第一代的 WEB架構。
It became common to reduce the overhead of these external scripts by grafting the script interpreter onto the WS. Web frameworks have, over time, started to take over much of the request-parsing aspect of the WS ("routing") - enough so that some frameworks decided to dispense with the WS entirely.
通常的做法是, 將指令碼解析器移植到webserver中,這樣可以減少外部指令碼的負載。
webframework, 經過時間演變, 開始接手請求解析部分(ws的routing), 導致一些架構開始可以不適用webserver就可以跑。
The style of web programming has also changed: javascript now puts a lot of the WF‘s logic into the browser, so that whatever logic is still on the WS may be much reduced (as opposed to the original CGI notion, where the browser really only handled rendering of a static blob of HTML provided by the WS.)
時間又在演變, 現代web編程的風格, 又有了新的變化, js現在實現了很多webframework的邏輯, 在瀏覽器中,
所以伺服器段的商務邏輯可以被大幅縮減。
So, usually when people say WS, they mean a generic WS like Apache. When people say WF, they usually mean something like PHP or more modern JS-based system that includes templating, ORM, routing, etc.
所以, 我麼說ws是指通用webserver, 當我們說webframework, 是指PHP或者現代js系統, 模板, ORM,路由等。
ORM
http://stackoverflow.com/questions/1279613/what-is-an-orm-and-where-can-i-learn-more-about-it
down vote
|
Introduction Object-Relational Mapping (ORM) is a technique that lets you query and manipulate data from a database using an object-oriented paradigm. When talking about ORM, most people are referring to a library that implements the Object-Relational Mapping technique, hence the phrase "an ORM". An ORM library is a completely ordinary library written in your language of choice that encapsulates the code needed to manipulate the data, so you don‘t use SQL anymore; you interact directly with an object in the same language you‘re using. |
Python web framework
https://jeffknupp.com/blog/2014/03/03/what-is-a-web-framework/
By now, the purpose of web frameworks should be clear: to hide the boilerplate and infrastructural code related to handling HTTP
requests and responses. Just how much is hidden depends on the framework. Django and Flask represent two extremes. Django includes something for every situation, almost to its detriment. Flask bills itself as a "micro-framework" and handles the bare minimum of web application functionality, relying on third-party packages to do some of the less common web framework tasks.
Remember, though, that at the end of the day, Python web frameworks all work the same way: they receive HTTP
requests, dispatch code that generates HTML, and creates an HTTP
response with that content. In fact, all major server-side frameworks work in this way (excluding JavaScript frameworks). Hopefully, you‘re now equipped to choose between frameworks as you understand their purpose.
web server && web framework角色區分