【发布时间】:2019-01-04 20:59:00
【问题描述】:
所以我正在使用 venv 浏览 Windows 10 上的 Falcon 教程
falcon==1.4.1
waitress==1.1.0
用户指南进展顺利,但提供:
httpd = simple_server.make_server('127.0.0.1', 8000, app)
httpd.serve_forever()
本教程目前使用两个文件:
resource.py:
import json
import falcon
class Resource(object):
def on_get(self, req, resp):
doc = {
'images': [
{
'href': '/images/1eaf6ef1-7f2d-4ecc-a8d5-6e8adba7cc0e.png'
}
]
}
resp.body = json.dumps(doc, ensure_ascii=False)
resp.status = falcon.HTTP_200
app.py:
import falcon
from .images import Resource
api = application = falcon.API()
images = Resource()
api.add_route('/images', images)
女服务员发起的:
waitress-serve --port=8000 look:app
提出的请求:
http localhost:8000/images
错误响应:
ERROR:waitress:Exception when serving /images Traceback(最近 最后调用):文件 "c:\users\ivan\dev\py\projects\falcon\look.venv\lib\site-packages\waitress\channel.py", 第 338 行,正在使用中 task.service() 文件 "c:\users\ivan\dev\py\projects\falcon\look.venv\lib\site-packages\waitress\task.py", 169 号线,正在使用中 self.execute() 文件 "c:\users\ivan\dev\py\projects\falcon\look.venv\lib\site-packages\waitress\task.py", 第 399 行,执行中 app_iter = self.channel.server.application(env, start_response) TypeError: 'module' object is not callable
任何想法/意见如何克服这个问题?
【问题讨论】:
标签: windows falconframework waitress