开发者

Executing of Python script

I found Python script for my task, but I don't know how I can execute this script on server with parameter (on my local machine I do it with command line). If this script is开发者_如何学运维 by address www.aaa.com/abc.py, then how can I execute it with parameters by browser or else?


You'll want to run the Python script from a CGI script.

First, create a CGI script, abc.sh like this:

#!/bin/sh
echo "HTTP 200 OK"
echo "Content-type: text/plain"
echo ""
./abc.py 2>&1

Make sure to chmod +x abc.sh, and stick both abc.sh and abc.py in your cgi-bin directory.

Then you should be able to visit example.com/cgi-bin/abc.sh, which will run the Python script.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜