如何在Web服务器上运行Python脚本?

时间:2021-09-14 01:28:29

I've just started learning Python, and I'm pretty lost right now. I want to run my script on my server that is hosted through hosting24.com. Their FAQ says they support Python, but I have no clue where to put my script for it to run.

我刚刚开始学习Python,现在我很丢失。我想在通过hosting24.com托管的服务器上运行我的脚本。他们的常见问题解答说他们支持Python,但我不知道在哪里放置我的脚本来运行它。

There is a folder called cgi-bin in my root, I'm guessing that is where I put my script? Can someone explain to me how this works?

在我的根目录中有一个名为cgi-bin的文件夹,我猜这是我放置脚本的地方?有人可以向我解释这是如何工作的吗?

1 个解决方案

#1


23  

Very simply, you can rename your Python script to "pythonscript.cgi". Post that in your cgi-bin directory, add the appropriate permissions and browse to it.

很简单,您可以将Python脚本重命名为“pythonscript.cgi”。在cgi-bin目录中发布,添加适当的权限并浏览到它。

This is a great link you can start with.

这是一个很好的链接,你可以开始。

Here's another good one.

这是另一个好的。

Hope that helps.

希望有所帮助。


EDIT (09/12/2015): The second link has long been removed. Replaced it with one that provides information referenced from the original.

编辑(2015年12月9日):第二个链接早已被删除。将其替换为提供原始参考信息的文件。

#1


23  

Very simply, you can rename your Python script to "pythonscript.cgi". Post that in your cgi-bin directory, add the appropriate permissions and browse to it.

很简单,您可以将Python脚本重命名为“pythonscript.cgi”。在cgi-bin目录中发布,添加适当的权限并浏览到它。

This is a great link you can start with.

这是一个很好的链接,你可以开始。

Here's another good one.

这是另一个好的。

Hope that helps.

希望有所帮助。


EDIT (09/12/2015): The second link has long been removed. Replaced it with one that provides information referenced from the original.

编辑(2015年12月9日):第二个链接早已被删除。将其替换为提供原始参考信息的文件。