【发布时间】:2022-08-19 02:30:11
【问题描述】:
在我的 Synology 上,我已经启动并运行了 webstation(经过测试) 默认服务器是 Apache 2.4。 默认情况下,在 DSM 7 上安装了 Python。现在我创建了一个简单的 test.py 脚本,我从浏览器调用它:
#!/usr/bin/python
import os
print (\"Content-type: text/html\\n\\n\")
print (\"<html>Hello world!</html>\")
if \'REQUEST_METHOD\' in os.environ :
print (\"This is a webpage\")
else :
print (\"This is not a webpage\")
当我运行此 \"192.bla.bla/web/test.py\" 时,代码不会执行,而只是显示。所以我在浏览器中得到了这个:
#!/usr/bin/python
import os
print (\"Content-type: text/html\\n\\n\")
print (\"<html>Hello world!</html>\")
if \'REQUEST_METHOD\' in os.environ :
print (\"This is a webpage\")
else :
print (\"This is not a webpage\")
显然Python没有执行所以我在网上搜索了这个,过时的德语,主题:Link to Topic
告诉我更改一些配置文件。但是,这些文件应该包含的目录不在我的系统上。我也不确定这是否是解决方案,因为这个主题已经过时了。
有人在 Synology 网站上运行 Python 吗?