mod_wsgi、mod_python 还是只是 cgi?

发布于 2024-09-11 20:08:12 字数 473 浏览 4 评论 0 原文

我一直在使用我自己的网络服务器(Apache+Ubuntu)和Python。据我所知,有 3(?) 个主要方法可以做到这一点:

  1. Apache 配置为将 .py 作为 cgi 处理
  2. Apache 配置为使用现在已经过时的 mod_python (?)
  3. Apache 配置为使用 mod_wsgi

我记得读过 Django 更喜欢 mod_wsgi ,而且我对学习 Django 有点兴趣(我听说他们的官方教程相当优秀)。

什么是“推荐”设置?我认为确实没有理由再使用 mod_python,但是将 .py 作为 cgi 和 mod_wsgi 处理之间有什么区别?是否有可能同时运行它们(你愿意吗?),或者这只是一个荒谬的想法,我应该停止思考如此疯狂的事情?

我想我真的只是在寻找关于 Apache+Python 的入门读物(链接也很好)——到目前为止我所遇到的都没有提供太多信息——它们主要只是操作方法。

I've been playing around with my own webserver (Apache+Ubuntu) and python. From what I've seen there are 3(?) main ways of doing this:

  1. Apache configured to handle .py as cgi
  2. Apache configured to use mod_python that is now outdated(?)
  3. Apache configured to use mod_wsgi

I recall reading that Django prefers mod_wsgi, and I'm kinda interested in learning Django (I've heard their official tutorial is rather excellent).

What is the 'recommended' setup? I presume there's really no reason to use mod_python anymore, but what are the differences between handling .py as cgi, and mod_wsgi? Is it possible to run them in tandem (and would you want to?), or is that just a ridiculous idea and I should stop thinking such crazy things?

I guess really I'm just looking for a primer on Apache+Python (links are also good) - nothing I've come across so far has been terribly informative - they were mainly just how-to's.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

鲜血染红嫁衣 2024-09-18 20:08:12

mod_python 已经死了,所以使用 mod_python 可能不是一个新项目的好主意。就我个人而言,我更喜欢使用 mod_wsgi 而不是 CGI(或 FastCGI)。它的设置非常简单,而且效率更高。

mod_python is dead, so using mod_python probably isn't a good idea for new projects. Personally, I prefer to use mod_wsgi over CGI (or FastCGI). It's dead-simple to set up, and much more efficient.

时常饿 2024-09-18 20:08:12
  1. 不要使用 CGI。这是低效的。为每个请求生成一个新进程。不,谢谢

  2. 不要花太多时间在 mod_python 上

  3. 使用 mod_wsgi。

如果您想在没有框架的情况下编写类似 CGI 的内容,请无论如何使用 mod_wsgi。 WSGI 标准 (PEP 333) 对于轻松创建 Web 应用程序至关重要、可互换、可重复使用、即插即用的方式。

  1. Don't use CGI. It's inefficient. Spawning a new process for each request. No thanks

  2. Dont't spend much time with mod_python

  3. Use mod_wsgi.

If you want to write CGI-like stuff without a framework, use mod_wsgi anyway. The WSGI standard (PEP 333) is essential for creating web applications in an easy, interchangeable, reusable, plug-and-playable way.

凯凯我们等你回来 2024-09-18 20:08:12

我也会选择 mod_wsgi 。

如果您想更深入地了解这个问题,请看一下:

好东西!

I would go with mod_wsgi too.

If you want a deeper understanding about the question, have a look at this:

Good stuff!

苏大泽ㄣ 2024-09-18 20:08:12

Mod_Python

mod_python 还活得很好。请参阅此处:http://modpython.org/。此外,这里是最新版本 3.5.0 的文档,支持 Python 3: http://modpython.org/ live/current/modpython.pdf。目前我正在使用它。

Mod_WSGI

mod_wsgi 认为自己不是使用准系统,而是使用框架,例如 Flask。

Mod_Python

mod_python is alive and well. See here: http://modpython.org/. Furthermore, here's the documentation for the latest release, 3.5.0, with support for Python 3: http://modpython.org/live/current/modpython.pdf. Currently I use it.

Mod_WSGI

mod_wsgi thinks of itself as not to be used barebones, but with a framework, such as Flask.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文