如何在HTML中运行python脚本? [英] How to run python script in HTML?

查看:633
本文介绍了如何在HTML中运行python脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我有一些python文件连接到用户输入的sqlite数据库,然后执行一些设置程序输出的计算。我是python web编程的新手,我想知道在web上使用python的最佳方法是什么?

例如:用户点击网页上的按钮。是否有可能?



我从Django开始。但是这需要一些时间来进行学习。我也看到了一些叫做CgiScripts的东西。我应该使用哪个选项?请指教。

解决方案

这可能取决于您想要做什么。我个人使用CGI,如果你的网页输入很简单,学习时间可能会更短,这可能会更简单。这里有一些资源:



然而,您仍然需要进行一些配置才能允许运行该程序而不是显示它。



以下是一个教程:

Currently I'm having some python files which connects to sqlite database for user inputs and then performs some calculations which sets the output of the program. I'm new to python web programming and I want to know what is the best method to use python on web?

Ex: I want to run my python files when the user clicks a button on the web page. Is it possible?

I started with Django. But it needs some time for the learning. And I also saw something called CgiScripts. Which option should I use? Please advice.

解决方案

It probably would depend on what you want to do. I personally use CGI and it might be simpler if your inputs from the web page are simple, and it takes less time to learn. Here are some resources for it:

However you may still have to do some configuring to allow it to run the program instead of displaying it.

Here's a tutorial on that: http://httpd.apache.org/docs/current/howto/cgi.html

这篇关于如何在HTML中运行python脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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