server.modules = (
...
"mod_cgi",
"mod_rewrite",
...
) server.document-root = "C: / Program Files / LightTPD / HTDOCS /"
index-file.names = ("index.py", "index.php", "index.pl", "index.cgi",
"index.html", "index.htm", "default.htm") static-file.exclude-extensions = (".php", ".pl", ".cgi", ". py") cgi.assign = (".py" => "C: /Python27/python.exe") server.port = 81
#!C:\Python27\python.exe -u #!/usr/bin/env python import cgi import cgitb; cgitb.enable() # for troubleshooting print "Content-type: text/html" print print """ <html> <head><title>Sample CGI Script</title></head> <body> <h3> Sample CGI Script </h3> """ form = cgi.FieldStorage() message = form.getvalue("message", "(no message)") print """ <p>Previous message: %s</p> <p>form form method="post" action="index.py" <p>message: <input type="text" name="message"/></p> </form> </body> </html> """ % cgi.escape(message) print "hello"; http: // localhost: 81 / index.pyshould work and just
http: // localhost: 81
Source: https://habr.com/ru/post/113190/
All Articles