I am trying to run a python sample test page but am unable to do so.. I have installed python27 and it installed fine. Then I created a test folder in inetpub/wwwroot. Here I placed my test.py fil开发者_JS百科e. Then I opened IIS 6.
Select the test site.
Right clicked it -> properties -> select create button. Then select scripts and executables from dropdown for execute permissions. Then I clicked the configuration button and added a new mapping with executable c:\Python27\python.exe -u "%s" "%s"and select all verbs.
Then I tried to run the file and it didn't work: http://localhost/test/test.py
I received the following error Error Type: Active Server Pages, ASP 0129 (0x80004005) The scripting language 'Python' is not found on the server. /test/python.asp, line 1
A quick google search find this tutorial about using IIS with python. It seems that you missed following steps:
Verify that application mapping for .py files is set up. To do this, perform the following steps:
In the ISM, under Internet Information Server, right-click the computer name, and then click Properties.
From the Master Properties drop-down list, click WWW Service and then click Edit.
- Click the Home Directory tab, and then click Configuration. To add the application mapping, click Add, and then create a new mapping by using the following information (substituting the correct path on your computer): Executable: "C:\Python20\python.exe %s %s" (The two "%s" after the executable are required for console-based script interpreters but would not be required for an Internet Server API [ISAPI]-based script interpreter). Extension: .py Script engine: selected.
- Check that File Exists: selected (for security) Click OK.
I came across this problem and registering python solved the problem.
cd C:\Python25\Lib\site-packages\win32comext\axscript\client
python pyscript.py register
精彩评论