Is it possible to run python on the net using imtqy.com?

I want to run a python file on the Internet that is in the github repository. Can this be done?

And while working on the Internet, I mean that in the first two lines I put "#! / Usr / bin / python" and "print" Content-type: text / html \ n ".

+8
python github web
source share
2 answers

In general, this is not possible, Github (pages) only serves static content (for example: HTML, CSS, JS). If you want python to start (ex generates dynamic content), you need a web server that can run python (the content of GitHub Pages has been loaded and launched in your browser).

However, there are experimental ways to run subsets of python in a browser. Take a look at this question .

+6
source share

If you really want to generate a complete HTTP response through standard output, then start by reading the CGI and the Python cgi module standard. You will also need access to a CGI-compatible web server, possibly running on a virtual host.

However, CGI is quite outdated to create dynamic output for the Internet. @jjwon suggest looking at the basics for Python-based web applications , for example Flask is good.

-4
source share

All Articles