【发布时间】:2014-02-14 23:19:13
【问题描述】:
我正在尝试在 arduino yun 上设置 python 和烧瓶。我已经设法通过 /etc/config/uhttpd 配置文件运行 python 文件:
...
list interpreter ".py=/usr/bin/python"
...
网站根目录的默认路径是:/www,我在其中放置了指向 sd 卡的软链接(应用程序)。所以现在我可以运行 python 程序了:http://[ip arduino]/apps/helloworld.py
当我创建我的第一个 helloflask.py 程序并通过 python helloflask.py 运行它时,我可以在以下位置看到结果:http://[ip arduino]:5000
但现在我想配置 uhttpd 迷你网络服务器(能够通过 CGI 交换信息)以使用烧瓶设置。 URI:http://flask.pocoo.org/docs/deploying/cgi/#server-setup 显示了一些说明……但我就是不明白。我创建了一个目录 ../apps/uno,在其中放置了一个 __init__.py 文件,其内容如下:
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "He Flask!"
在应用程序目录中,我放置了一个文件:cgi.py,其中包含以下内容:
from wsgiref.handlers import CGIHandler
from uno import app
CGIHandler().run(app)
现在我浏览:http://[ip arduino]/cgi.py 出现服务器错误,联系管理员(我认为这是来自 uhttpd 的 CGI 接口)。
我只是不了解 Flask/uhttpd 的 CGI 配置
【问题讨论】: