We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(7)
有多简约以及目的是什么?
SimpleHTTPServer 作为标准 Python 库的一部分免费提供。
如果您需要更多功能,请查看 CherryPy 或(在顶部)扭曲。
How minimalistic and for what purpose?
SimpleHTTPServer comes free as part of the standard Python libraries.
If you need more features, look into CherryPy or (at the top end) Twisted.
我正在成为新发布的 Circuits 库的忠实粉丝。 它是一个组件/事件框架,附带一组非常好的软件包,用于创建 Web 服务器和应用程序。 应用。 下面是来自该站点的简单 Web 示例:
它的 WSGI 支持也并不比这更复杂。 好东西。
I'm becoming a big fan of the newly released circuits library. It's a component/event framework that comes with a very nice set of packages for creating web servers & apps. Here's the simple web example from the site:
Its WSGI support is no more complicated than that, either. Good stuff.
如果您要做很多并发的事情,您可以考虑 Kamaelia 的 HTTPServer。
If you're doing a lot of concurrent stuff, you might consider Kamaelia's HTTPServer.
我发现 web.py 非常容易使用: http://webpy.org/
I've found web.py pretty easy to use : http://webpy.org/
如果您想使用标准库中的某些内容,我强烈建议不要使用 SimpleHTTPServer,而是使用
wsgiref.simple_server
。 SimpleHTTPServer 是一种笨拙且相当无意义的 Web 应用程序实现方式,虽然原始 WSGI 并不是很容易(但肯定是可能的),但您可以选择在其之上使用任何基于 WSGI 的框架。 另外,如果您使用 wsgiref,您稍后可以选择更改为像 CherryPy 这样的服务器(请注意,CherryPy 中的服务器可以与框架的其余部分分开使用,并且您只需要 一个文件仅用于服务器)。 对于“真正的”Web 应用程序,CherryPy 比 wsgiref 有几个优点,但对于本地托管的应用程序来说,这些优点都不重要。如果您正在制作桌面应用程序,则需要为 wsgiref 或 CherryPy 启动单独的线程。 如果没问题,那么基于 WSGI 的服务器可能是最简单的。 如果您不想为服务器启动单独的线程,那么您很可能需要使用 Twisted。
If you want to use something from the standard library I would strongly recommend not using SimpleHTTPServer, but instead using
wsgiref.simple_server
. SimpleHTTPServer is awkward and a rather nonsensical way to implement a web application, and while raw WSGI isn't terribly easy (but certainly possible), you have the option to use any WSGI-based framework on top of it. Also if you use wsgiref you will have the option to change to a server like CherryPy later (note that the server in CherryPy can be used separately from the rest of the framework, and you only need one file for just the server). For a "real" web application CherryPy has several advantages over wsgiref, but for a locally hosted application it's unlikely any of them will matter.If you are making a desktop application you will need to launch a separate thread for either wsgiref or CherryPy. If that's fine, then a WSGI-based server would probably be easiest. If you don't want to launch a separate thread for the server then you most likely need to use Twisted.
请参阅 WSGI 参考实现。
See the WSGI reference implementation.
我做了这个。 它只是稍微增强了 Python 的 SimpleHTTPServer 功能,让您可以根据需要定义自定义操作根据要求。
I made this one. It just enhances Python's SimpleHTTPServer a bit to let you define custom actions depending on the request.