从网页调用Python脚本 [英] Calling a Python script from a webpage
问题描述
我已经搜查了一段时间,但我不能找到如何做我想做一个简要说明。
I've searched around for a while but I can't find a concise explanation of how to do what I want.
我有一个相当复杂的程序,我想使一个简单的Web界面,
I have a fairly complex program which I'd like to make a simple web interface for.
在理想情况下就会有一对夫妇的文本字段,在网页上的福和栏。
Ideally there'll be a couple of text fields, "foo" and "bar" on a webpage.
当用户点击提交,Python脚本的src / script.py运行,它可以访问这些领域的莫名其妙的内容。
When the user clicks submit, a python script "src/script.py" is run, which has access to the contents of these fields somehow.
我的Apache2和mod_python。
I have apache2 and mod_python.
推荐答案
如果这是一个相当复杂的程序,您可能需要使用一个小的框架,需要在标准分组零件的照顾,即支持和据可查,方式。我会考虑的轻便的Python Web框架为瓶并的 webapp2的。的轻型的在性能方面和学习曲线。
If it is a "fairly complex program" you may want to use a small framework that takes care of grouping the parts in a "standard", i.e. supported and documented, manner. I would look into lightweight Python Web frameworks as Flask and WebApp2. Lightweight in terms of both performance and learning curve.
这里你得到Python Web框架的全面概述。
Here you get a full overview of Python web frameworks.
这篇关于从网页调用Python脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!