【问题标题】:How to get my smartThings python3 script working on apache webserver as a cgi file如何让我的 smartThings python3 脚本在 apache 网络服务器上作为 cgi 文件运行
【发布时间】:2020-08-15 13:31:28
【问题描述】:

我父亲和我正在制作一个网络服务器,以便 Grafana 能够访问一些 python 脚本; Grafana 只允许您将 links 添加到按钮。今天早些时候,我们创建了网络服务器。然后我开始研究两个 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】:
    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 对我们很刻薄。

    【讨论】:

      猜你喜欢
      • 2016-12-08
      • 2018-01-30
      • 2013-03-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-09-30
      • 2012-07-27
      相关资源
      最近更新 更多