如何将我的smartThings python3脚本作为cgi文件在apache网络服务器上工作

问题描述 投票:0回答:1

和我父亲正在建立一个网络服务器,因此Grafana将能够访问一些python脚本; Grafana仅允许您将links添加到按钮。今天早些时候,我们创建了Web服务器。然后,我开始处理两个Python文件“ smartThingy.py”和“ printLight.cgi”。创建这些文件后,我将它们放在网络硬盘上,然后我父亲将它们移动到运行apache的centos 8机器上。在使文件不是DOS格式后,它起作用了。当前,我们遇到了一个小错误https://pastebin.com/TXhXFPwm 。有人可以帮助调试代码,以便我们通过转到http://PrivateIpOfTheServer/cgi-bin/printLight.cgi

来打开和关闭灯。

这是我的代码。它只缺少允许它在页面上输出文本的位。

[https://pastebin.com/qn2EMYhZ -smartThingy.py(一个模块,因此可以更轻松地创建更多的cgi文件)]

[https://pastebin.com/9J8HMYS7 -printLight.cgi(控制3d打印机上方的光)

编辑:我正在将https://pypi.org/project/pysmartthings/用于smartThings

python-3.x apache python-asyncio aiohttp centos8
1个回答
0
投票
SELinux is preventing /usr/libexec/platform-python3.6 from name_connect access on the tcp_socket port 443.

*****  Plugin catchall_boolean (47.5 confidence) suggests   ******************

If you want to allow httpd to can network connect
Then you must tell SELinux about this by enabling the 'httpd_can_network_connect' boolean.

Do
setsebool -P httpd_can_network_connect 1

SELinux只是对我们卑鄙。

© www.soinside.com 2019 - 2024. All rights reserved.