Tuesday, February 25, 2014

Simple intro to using Python with IIS

Create an application
Add a script map
Request Path: *.py
Executable: C:\Python25\Python.exe %s %s
Name: Python

Add a file to the directory call it test.py
print
print 'Status: 200 OK'
print 'Content-type: text/html'
print
print ''
print ''
print '

This is a header

'
print '
' #this is a comment
print 'See this is just like most other HTML'
print '
'
print ''

Navigate to http://localhost/myWeb/test.py

Query strings and other HTTP parameters can be accessed through:
method = os.environ["REQUEST_METHOD"]
if method == "GET":
query = cgi.FieldStorage()
coName = query.getvalue("co")

No comments: