【发布时间】:2013-08-24 19:28:32
【问题描述】:
我已经将我的第一个 Python/Flask 应用程序部署到了 heroku。 该应用程序包含在一个 html 页面中,比如说 index.html,它带有一个 javascript 函数,该函数创建一个对在“url”处运行的 python 应用程序的查询
function getDistance(position) {
url = 'http://127.0.0.1:5000/geodesicDistance';
query = position.coords.latitude.toString()+','+position.coords.longitude.toString();
$.get(url, {'q': query},function(data) {
$('#results .distance')[0].innerHTML = Math.round(data['result']['distance']*1000)/1000;
})
}
python 应用程序接受查询并返回结果
该应用程序实际上在 http://geodesicdistance.herokuapp.com/ 运行,但我无法显示根文件夹中的 index.html 页面
【问题讨论】:
标签: javascript python html heroku flask