【发布时间】:2016-12-13 07:11:19
【问题描述】:
我想创建一个 REST 服务,所以我尝试了,这是我的 sn-p
from bottle import route, run
@route('/plot_graph',method='GET')
def plot_graph():
#compute graph_list (python object of type list)
#done
return graph_list
if __name__ == "__main__":
run(host='0.0.0.0', port=8881, server='cherrypy', debug=True)
现在,当我在浏览器 http://localhost:8881/plot_graph 中输入它时,会出现错误
Error: 500 Internal Server Error
Sorry, the requested URL 'http://localhost:8881/plot_graph' caused an error:
Unsupported response type: <type 'int'>
我的 python 控制台说它正在监听但给出了这个警告
Bottle v0.12.9 server starting up (using CherryPyServer())...
Listening on http://0.0.0.0:8881/
Hit Ctrl-C to quit.
/Users/guru/python_projects/implement_LDA/lda/lib/python2.7/site-packages/bottle.py:2777: ImportWarning: Not importing directory '/Users/guru/python_projects/implement_LDA/lda/cherrypy': missing __init__.py
from cherrypy import wsgiserver
有什么办法可以解决这个问题?
【问题讨论】:
-
我在虚拟环境中做了所有事情