我可以同时为 Windows 和 Linux 平台编写 Python Web 应用程序吗?

发布于 2024-07-15 20:41:11 字数 135 浏览 3 评论 0原文

我是否可以编写可以在 Windows(IIS Web 服务器)和 Linux(Apache 或 lighttpd)上托管的 Web 应用程序,而无需进行任何更改?

计算机生成图像? 也许有新东西? WSGI | 快速CGI?

Can I write web application that I can host on Windows(IIS web server) and Linux (Apache or lighttpd) without any changes?

CGI? Maybe something new? WSGI | FastCGI ?

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

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

发布评论

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

评论(6

少女情怀诗 2024-07-22 20:41:11

是的你可以。 但你也可以在 Windows 上使用 apache。 如果您采用 IIS 方式,则只有 CGI 并且很难设置。 您还可以使用基于 python 的服务器,例如 CherryPy,它非常好,并且可以在所有使用 python 的平台上运行。

有些框架(例如 django)同时支持 CGI 和 WSGI,因此您不必太担心 WSGI 或 CGI 的细节。

如果你问我,WSGI 是 Python Web 应用程序的未来。

Yes you can. But you can also use apache on windows. If you go the IIS way there's only CGI and it's pretty hard to set up. You can also use python based server like CherryPy which is pretty good and will work on all platforms with python.

Some frameworks like django support both CGI and WSGI, so you don't have to worry about the details of WSGI or CGI much.

If you ask me, WSGI is the future for python web apps.

旧伤慢歌 2024-07-22 20:41:11

web.py 包含一个服务器...它可以完成小型工作。

顺便说一句,Apache 可以在 Windows 上运行。

web.py includes a server... It will do the trick for small jobs.

By the way, Apache works on windows.

新一帅帅 2024-07-22 20:41:11

是的,如果您使用 CGI、FastCGI 或根据您的框架,甚至是独立的 Web 服务器(因此 IIS 和 Apache 将是反向代理),那么这一切都可以工作。

不同之处在于特定于操作系统的服务器的配置,以及每个操作系统上的 Python 环境。 因此,您可能会发现自己在开始时做了一些工作,以确保您的路径是正确的,等等。

Yes, if you use CGI, FastCGI or depending on your framework, even a self-contained web server (so IIS and Apache would be a reverse-proxy) then that would all work.

The difference will be the configuration of the OS-specific servers, and also your Python environment on each OS. So you may find yourself doing a small bit of work at the beginning to make sure your paths are right, etc.

酒儿 2024-07-22 20:41:11

一个相当大的基于 Python 的 Web 框架是 ZOPE

Zope 是一个开源应用程序服务器,用于构建内容管理系统、内部网、门户和自定义应用程序。 Zope 社区由世界各地数百家公司和数千名开发人员组成,致力于构建平台和 Zope 应用程序。 Zope 是用 Python 编写的,Python 是一种高效的面向对象的脚本语言

ZOPE 可在 Linux 和 Windows 上使用,您可以使用 Python 编写您的 Zope Web 应用程序(它包括一个更简单的模板系统,也)。

A rather big Python based web framework is ZOPE.

Zope is an open source application server for building content management systems, intranets, portals, and custom applications. The Zope community consists of hundreds of companies and thousands of developers all over the world, working on building the platform and Zope applications. Zope is written in Python, a highly-productive, object-oriented scripting language

ZOPE is available on Linux and Windows, and you can use Python to write your Zope Web Apps (it includes a simpler templating system, too).

秋凉 2024-07-22 20:41:11

还要考虑使用 web2Py、XML-RPC 实现或 Twisted 的可能性...

consider also the possibility of using web2Py, or XML-RPC implementation, or Twisted...

弄潮 2024-07-22 20:41:11

编写 python Web 应用程序本身就是一个主题,但我想说的是,默认情况下,它可以在多个服务器/平台上移植。

在开发 Python Web 应用程序时,您经常会使用提供自己的 Web 服务器的框架。 出于性能原因,您可能希望将其放置在 apache 服务器后面,但这甚至没有必要,但是,通过将其放置在 apache 服务器后面可能会获得性能提升。

一些最流行的 Web Python 框架有:Plone、Zope、CherryPy 和 TurboGears,仅举几例。

在 apache 下,您还可以通过 mod_python 使用 python 服务器页面,并且由于 apache 也在 Windows 上运行,因此这也是可移植的。

Writing python web apps is a topic on itself, but I would say that by default, it will be portable on multiple servers / platforms.

When developping python web applications, you will often use frameworks that provide their own web server. For performance reasons, you might want to place it behind apache, but it is not even necessary, however, you might get a performance boost by placing it behind an apache server.

Some of the most popular frameworks for web python are : Plone, Zope, CherryPy and TurboGears, only to name a few.

Under apache, you could also use python server pages through mod_python, and since apache runs on windows too, this would aslo be portable.

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