Python heroku的烧瓶服务
我试图弄清楚如何使用flask和JSONRPC在heroku上运行web服务。 我想从我的桌面上实现以下目标:Python heroku的烧瓶服务,python,heroku,flask,json-rpc,Python,Heroku,Flask,Json Rpc,我试图弄清楚如何使用flask和JSONRPC在heroku上运行web服务。 我想从我的桌面上实现以下目标: from flask_jsonrpc.proxy import ServiceProxy service = ServiceProxy('http://<myapp>.heroku.com/api') result = service.App.index() print result 并尝试将该端口用于: service = ServiceProxy('http://&
from flask_jsonrpc.proxy import ServiceProxy
service = ServiceProxy('http://<myapp>.heroku.com/api')
result = service.App.index()
print result
并尝试将该端口用于:
service = ServiceProxy('http://<myapp>.heroku.com:21020/api')
这就是应用程序(我知道的不多,只是想看看heroku是如何工作的)
这是我的Procfile的内容:
web: gunicorn run:app -p $PORT
我是不是漏掉了什么明显的东西?
干杯
L
p、
访问http://.heroku.com/api/browse
通过foreman和部署的应用程序,它似乎运行良好
[编辑]
已解决:
是的,我错过了什么。。。。从日志上看,我注意到主机是:
host=<myapp>.herokuapp.com
host=.herokuapp.com
而不是
.heroku.com
把地址换成正确的地址,一切似乎都很好。
http://.herokuapp.com/api所有已排序,请参阅原始帖子。 对不起,吵闹了
import os
from flask import Flask
from flask_jsonrpc import JSONRPC
app = Flask(__name__)
jsonrpc = JSONRPC(app, '/api', enable_web_browsable_api=True)
@jsonrpc.method('App.index')
def index():
return u'Welcome to Flask JSON-RPC'
if __name__ == '__main__':
port = int(os.environ.get("PORT", 5000))
app.run(host='0.0.0.0', debug=True, port=port)
web: gunicorn run:app -p $PORT
host=<myapp>.herokuapp.com