简体   繁体   English

IIS 上的 python cgi

[英]python cgi on IIS

How do you set up IIS so that you can call python scripts from asp pages?如何设置 IIS 以便可以从 asp 页面调用 python 脚本?

Ok, so I found the answer to that question here:好的,所以我在这里找到了该问题的答案: http://support.microsoft.com/kb/276494 http://support.microsoft.com/kb/276494

So on to my next question: How do you call a cgi script from within classic asp (vb) code?继续我的下一个问题:如何从经典的 asp (vb) 代码中调用 cgi 脚本? Particularly one which is not in the web root directory.特别是不在 web 根目录中的一个。

You could also do it this way .你也可以这样做。

I don't believe that VBScript as hosted by IIS has any way of executing an external process.我不相信由 IIS 托管的 VBScript 有任何执行外部进程的方式。 If you are using python as an AXscripting engine then you could just use the sys module.如果您使用 python 作为 AXscripting 引擎,那么您可以只使用 sys 模块。 If the script you're calling is actually meant to be a cgi script you'll have to mimic all the environment variables that the cgi uses.如果您调用的脚本实际上是一个 cgi 脚本,您将不得不模仿 cgi 使用的所有环境变量。 The alternative is to put the script on the python path, import it and hope that it is modular enough that you can call the pieces you need and bypass the cgi handling code.另一种方法是将脚本放在 python 路径上,导入它并希望它足够模块化,以便您可以调用所需的部分并绕过 cgi 处理代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM