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

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

问题描述

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

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?

例如:当用户单击网页上的按钮时,我想运行我的 python 文件.可能吗?

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

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

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.

推荐答案

这可能取决于您想要做什么.我个人使用 CGI,如果您从网页中输入的内容简单,那么它可能会更简单,并且学习所需的时间更少.以下是它的一些资源:

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.

这里有一个教程:http://httpd.apache.org/docs/current/howto/cgi.html

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

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