Executing Python Game from Glitch Website


#1

Hello,
I have a python game that I need to execute from index.html page. I have defined a server.sh file as

"# For development use (simple logging, etc):
python server.py

For production use:

gunicorn server:app -w 1 --log-file -

my server.py file has the python code for the game.

The index.html file just contains simple HTML. How do I link up the code in server.py to the show/render from index.html?

My project is in https://glitch.com/edit/#!/exuberant-week

Thanks
Ema


#2

We don’t officially support Python, but you can try this:

  1. Create a requirements.txt file so that Glitch detects a Python project

  2. Rename server.sh into start.sh

You should now be able to run python on the backend. I don’t know if this is what you need, but I am not really sure what you mean with “execute a python game from index.html”, since browsers can’t execute python except if they use some JIT compiler.