创建简单的 Python Web 服务的最佳方式 [英] Best way to create a simple python web service

查看:30
本文介绍了创建简单的 Python Web 服务的最佳方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用 python 多年,但我对 python web 编程的经验很少.我想创建一个非常简单的 web 服务,它从现有的 python 脚本中公开一些功能,以供我公司使用.它可能会以 csv 格式返回结果.什么是最快的方法?如果这会影响您的建议,我可能会在未来为此添加更多功能.

I've been using python for years, but I have little experience with python web programming. I'd like to create a very simple web service that exposes some functionality from an existing python script for use within my company. It will likely return the results in csv. What's the quickest way to get something up? If it affects your suggestion, I will likely be adding more functionality to this, down the road.

推荐答案

查看 werkzeug.Werkzeug 最初是 WSGI 应用程序的各种实用程序的简单集合,现已成为最先进的 WSGI 实用程序模块之一.它包括一个强大的调试器、功能齐全的请求和响应对象、处理实体标签的 HTTP 实用程序、缓存控制标头、HTTP 日期、cookie 处理、文件上传、一个强大的 URL 路由系统和一堆社区贡献的插件模块.

Have a look at werkzeug. Werkzeug started as a simple collection of various utilities for WSGI applications and has become one of the most advanced WSGI utility modules. It includes a powerful debugger, full featured request and response objects, HTTP utilities to handle entity tags, cache control headers, HTTP dates, cookie handling, file uploads, a powerful URL routing system and a bunch of community contributed addon modules.

它包含了很多很酷的工具来处理 http,并且有一个优势,你可以在不同的环境(cgi、fcgi、apache/mod_wsgi 或一个简单的 Python 服务器进行调试)中将它与 wsgi 一起使用.

It includes lots of cool tools to work with http and has the advantage that you can use it with wsgi in different environments (cgi, fcgi, apache/mod_wsgi or with a plain simple python server for debugging).

这篇关于创建简单的 Python Web 服务的最佳方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆