![]() |
1. - Click Start -> Administrative Tools - Open Internet Information Services (IIS) Manager
|
![]() |
2. Setup python web service extension - Click on the '+' next to your server name
|
![]() |
3. - Click 'Web Service Extensions' - Click 'Add a new Web service' - DO NOT enable 'all unknown CGI extensions' if you cannot get python cgi's to work (refer to step 17 for more info) |
![]() |
4. - Type in a name of your choice for the Python extension - Click 'Add...' |
![]() |
5. - Click 'Browse...' |
![]() |
6. - Select 'CGI exe files(*.exe)' |
![]() |
7. - Browse to the installation directory of your python distribution |
![]() |
8. - Select the 'python.exe' executable - Click 'open' or simply press <enter> |
![]() |
9. - now add ' -u "%s" "%s"' (-u prevents newlines from being converted to Carriage return/ newline combinations which can sometimes cause problems) %s is string substitution - The first for the name of the python script(i.e. hello.py) the other for arguments it might be passed |
![]() |
10. - Click on OK and disregard this message |
![]() |
11. - Click the 'Set extension status to allowed' checkbox - Click OK |
![]() |
12. - Right-Click on the Website that you would like to add Python CGI - Select Properties
|
![]() |
13. - Click the 'Home Directory' tab - Click the 'Configuration...' button |
![]() |
14. - Click 'Add...' button |
![]() |
15. - Click 'Browse...' button |
![]() |
16. - Again you must Select 'CGI exe files(*.exe)' - Then select the 'python.exe' executable - Click 'Open' or press <enter> |
|
17. - This is important: - make sure there is correct spacing and that everything in lowercase. - if you didn't decide to use the -u option adding the Web Service Ext. you will want to make sure that you make this mapping match If you don't do this it won't be recognized as an allowed WSE and your mapping will fail DO NOT enable 'all unknown CGI extensions' Some People mistakenly just enable 'all unknow CGI extensions' because they cannot get python scripts to run simply because they didn't type something correctly when adding the WSE mapping & allowed ext.'s. This can be a security risk. - Type '.py' in the 'Extension' box - Click the 'Limit to:' radio button - Type 'GET,HEAD,POST' - Click 'OK ' |
![]() |
18. Your '.py' extension should now be in your list |
![]() |
19. This is up to you. If you have any sub-sites or folders in your virtual directory you can add python to these also. I didn't but you may want to. - Click 'OK' |
![]() |
20. - Click on 'OK' - Python CGI should now function on your server |
print 'Content-type: text/html' print '<HTML><HEAD><TITLE>Python Sample CGI</TITLE></HEAD>' print '</BODY></html>' |
21.Testing: Now it is time to test your server with a python CGI script. - Create a new python file using your favorite editor using this snippet of code.(I know that this code works) - Make sure that the tabbing for the code is correct(sorry for the tabs not showing up before in the if/else block)
|
|
22. Troubleshooting python cgi for IIS 6.0: The page cannot be found. HTTP error 404 - your url is incorrect - screwed up somthing on step #3 (adding allowed WSE) - and many other reasons |
![]() |
"CGI Error The specified CGI application misbehaved by not returning a complete set of HTTP headers" - This can be caused by many things but likely you have: - completed Step 17 correctly(WSE mapping) - didn't type in the header correctly in your cgi code i.e.: print 'Content-type: text/html' If you are still having problems, you can email me. (hint: my name is mark and the domain is markrowsoft dot ...) |
![]() |
Congratulations!!!
You now can run python CGI on IIS 6.0.
|