本文由我司收集整编,推荐下载,如有疑问,请与我司联系可以在web上使用github.io运行python吗?
可以在web上使用github.io运行python吗?[英]Is it possible to run python in the web with github.io? I want to run a python file in the web I have in a GitHub repository. Is it possible to do this?
?我想在GitHub存储库中运行一个python文件。有可能做到吗?
?And by running in the web, I mean putting #!/usr/bin/python and print ‘Content-type:text/html\n in the first two lines.
?在网络上运行,我的意思是输入#!/usr/bin/python和打印’Content-type:text/html\n
在前两行。
7
?In general this is not possible, Github (pages) serves only static content (ex: HTML, CSS, JS). If you want python to run (ex generate dynamic content) you need a web server capable of running python (your browser were the contents of GitHub Pages get downloaded and run can’t do it).
?一般来说,这是不可能的,Github(页面)只提供静态内容(例如:HTML、CSS、JS)。如果您想让python运行(ex生成动态内容),您需要一个能够运行python的web服务器(您的浏览器是下载并运行GitHub页面的内容,不能运行它)。
?That said there are experimental ways of running subsets of python in the browser. Take a look for a example at this question.
?也就是说,有在浏览器中运行python子集的实验方法。看看这个问题的一个例子。
-4
?If you truly want to generate a complete HTTP response via standard output, then start by reading about CGI and Python’s standard cgi module. You’ll also need to have access to a CGI-compatible web server, perhaps running on a virtual host.
?如果您确实希望通过标准输出生成完整的HTTP响应,那么请从阅读关于CGI和