prod 中的 python Web 应用程序
我正在考虑使用 python 服务基于 json 的 Web 服务,我的优先事项按顺序是:
- 可维护性
- 易于编码
- 高可用性
- 性能
Apache->AJP->Flup->Python 对我来说似乎没问题,您会推荐其他设置还是这样可以吗?
I am considering to use python serving json based web services, my priorities are, in order:
- maintainability
- easy of coding
- high availability
- performance
Apache->AJP->Flup->Python seems ok to me, would you recommend another setup or is this ok ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
AJP 在这种情况下会做什么?我能找到的唯一“错误”是一个包含“随机分类的 WSGI 服务器”的软件包,这似乎不是很有帮助。
我建议您查看 Pyramid 和 Django.两个具有不同理念的 Python Web 框架都可以满足您的要求。然后选择您最喜欢的一个。
What would AJP do in that setup? The only "flup" I can find is a package with a "Random assortment of WSGI servers", which doesn't seem very helpful.
I'd recommend you to look at Pyramid and Django. Two Python web frameworks with different philosophies that both fulfill your requirements. Then pick the one that you like best.
如果您已经了解 flup,那么该设置将会起作用。还有大约一百万个其他配置,包括使用一些纯 python 服务器(和 Apache ProxyPass)。如果您需要 Tomcat,那么这是完全合理的。我建议将
paste
添加到组合中以管理配置。That setup will work, if you already know flup. There are about a million other configs, including using some pure python server (and Apache ProxyPass). If you need Tomcat, then this is totally reasonable. I recommend adding
paste
into the mix for managing the configuration.选择任何 WSGI 兼容框架(例如已经提到的 Pyramid、Django 或 Pylons 等),您将拥有很多部署可能性。有一个很好的基准 WSGI服务器,nginx + uWSGI似乎是一个很好的解决方案。
Choose any WSGI-compatible framework (like already mentioned Pyramid, Django or Pylons, to name a few) and you will have plenty of deployment possibilities. There is a nice benchmark of WSGI servers, nginx + uWSGI seems like a good solution.
您没有提供足够的信息来回答这个问题。您的 Web 服务在做什么(除了提供 JSON 服务)?数据从哪里来?有多少种不同类型的输出?它的动态程度如何?需要什么样的处理?需要认证吗?是否需要数据库连接?会休息吗?它是否需要处理 POST 以及 GET ?等等,等等。
如果您只是非常简单地要求以只读方式提供几种不同类型的内容,那么您提出的解决方案可能会很好(尽管像 Lennart 一样,我不明白 AJP 在那里做什么)。不过,如果您有更复杂的东西,您可能需要研究在 Apache + mod_wsgi 上运行的 Django + Piston。
You don't give enough information to answer this question. What is your web service doing (apart from serving JSON)? Where does the data come from? How many different types of output are there? How dynamic is it? What sort of processing is required? Does it need authentication? Does it need a database connection? Will it be REST? Does it need to handle POSTs as well as just GETs? And so on, and on.
Your proposed solution might be good (although like Lennart I don't understand what AJP is doing in there), if you just very simple requirements to serve a few different types of content on a read-only basis. Again, though, if you have anything more complex you may want to look into Django + Piston, running on Apache + mod_wsgi.