我已經將第一個Python/Flask應用程序部署到了heroku。 該應用程序包括在HTML頁面,讓我們說的index.html,與創建查詢到Python應用程序在「URL」如何使用Python/Flask顯示heroku中的index.html頁面
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應用程序需要查詢運行,還給結果的javascript函數
的應用程序實際上是在http://geodesicdistance.herokuapp.com/運行,但我不能管理,以顯示index.html頁面是在根文件夾
PS:我的github在這裏https://開頭github.com/valdelmeglio/geodesicDistance – user2697881