WSGI、CGI、FastCGI 和 mod_python 在 Python 方面的区别和用途?
我只是想知道不同的 CGI 有什么区别和优势。哪一个最适合 python 脚本,我如何告诉脚本使用什么?
I'm just wondering what the differences and advantages are for the different CGI's out there. Which one would be best for python scripts, and how would I tell the script what to use?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您问题的部分答案,包括 scgi。
懒惰而不是我自己写的。来自维基百科: http://en.wikipedia.org/wiki/FastCGI
由于为每个请求创建一个新进程,FastCGI 使用持久进程来处理此类请求。可以配置多个进程,提高稳定性和可扩展性。每个单独的 FastCGI 进程可以在其生命周期内处理许多请求,从而避免每个请求进程创建和终止的开销
A part answer to your question, including scgi.
Lazy and not writing it on my own. From the wikipedia: http://en.wikipedia.org/wiki/FastCGI
Instead of creating a new process for each request, FastCGI uses persistent processes to handle such requests. Multiple processes can configured, increasing stability and scalability. Each individual FastCGI process can handle many requests over its lifetime, thereby avoiding the overhead of per-request process creation and termination
还有一个关于 CGI、WSGI 和其他选项的很好的背景阅读器,以官方 python HOWTO 的形式:http://docs.python.org/2/howto/webservers.html
There's also a good background reader on CGI, WSGI and other options, in the form of an official python HOWTO: http://docs.python.org/2/howto/webservers.html
在像 Django 这样的项目中,您可以使用 WSGI (Web 服务器网关接口) 来自 Flup 模块。
WSGI 服务器使用一个或多个协议包装后端进程:
2019 年,WSGI 被 ASGI 取代(异步服务器网关接口),由 FastAPI 等框架使用服务器,例如 Uvicorn,即 快得多。
In a project like Django, you can use a WSGI (Web Server Gateway Interface) server from the Flup module.
A WSGI server wraps a back-end process using one or more protocols:
In 2019, WSGI was superseded by ASGI (Asynchronous Server Gateway Interface), used by frameworks like FastAPI on servers like Uvicorn, which is much faster.
FastCGI 与 CGI 之间的详细区别CGI
In Detail Diff between FastCGI vs CGI