Image

Python is a cross-platform programming language with dynamic strong typing, aimed at improving developer productivity, code readability, and quality. The language is fairly simple and is widely loved by the developer community for writing simple scripts.

In hosting, it works via the CGI module. To ensure it is enabled, go to the control panel in the Hosting Settings section.


Next, place the script in the special CGI-BIN folder, which is located in the root of your domain:

test.py (containing the following)

#! /usr/bin/python
print "Content-type: text/html"
print
print "Python Support | Pages | Winter CMS
"

import sys
sys.stderr = sys.stdout

import os
from cgi import escape
print "Python %s" % sys.version
keys = os.environ.keys( )
keys.sort( )
for k in keys:
print "%s\t%s" % (escape(k), escape(os.environ[k]))
print "
"




After that, you need to set the correct permissions for the file; they should be set to 755. This can be done via FTP, file manager, or SSH. Test the script by opening the link http://your-domain.tld/cgi-bin/test.py




The script will display information about the Python version and environment variables.