I want to run a python file in the web I have in a GitHub repository. Is it possible to do this?
And by running in the web, I mean putting #!/usr/bin/python
and print 'Content-type:text/html\n
in the first two lines.
Run Python Script is not certified by GitHub.
Brython is both a Python compiler and an interpreter written in JavaScript. As a result, you can compile and run Python code in the browser. A good example of this feature is demonstrated by the online editor available on the Brython website. With the online editor, Python is running in the browser.
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).
That said there are experimental ways of running subsets of python in the browser. Take a look for a example at this question.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With