Can anyone assist me in getting a Python script running on Hostgator Shared hosting? I work with PHP mostly, but have taken a liking to Python, and would like to try to get it going on the web. The only way I’ve ever ran Python is with either the interpreter, or through a terminal, with >Python file.py. I tried just uploading a hello world file to the webserver, but all it outputs is the script source. I talked with hostgator, but all they could tell me was I need to use a dispatcher, which I cannot seem to find an example of. All I want to know, is how to make a <p>Hello</p> output to the browser.
Thanks, and sorry if I’m rambley, I’ve been Googling this off and on all week now.
Well, I got this from Hostgator’s own support site.
Assuming your host is running Python 2.x, then you can adapt the linked-to script as follows:
and put it in your
cgi-binfolder with permissions of 755.Update: In terms of “getting around” the cgi-bin folder: that’ll depend on options your hosting package allows. Look at Bottle for a simple dispatcher which fits in a single Python module. You can deploy it using CGI,
Further update: Apart from the Bottle docs, I suggest you read the Python docs about CGI.