지도/로컬 API에 대한 문의게시판입니다.from flask import Flask, request, render_template
파이썬 플라스크 사용해서 map Api 사용한 HTML을 불렀을때
Document mainfrom flask import Flask, request, render_template
app = Flask(name)
@app.route(‘/’)
def home():
return render_template(‘test.html’)@app.route(‘/result’,methods=[‘POST’, ‘GET’])
def result():
if request.method == ‘POST’:
result = request.form
return render_template(“test.html”,prediction = result)if name == “main”:
app.run()
<body>
<form action="/result" method="POST">
<input type="text" id="inputValue" name="data1" /><input type="submit" value="검색" id="searchBtn" />
</form>
<input type="button" value="현위치로 검색" id="nowBtn" />
<div id="map" style="width:800px; height:700px; text-align:center;"></div>
<p id="prediction">{{ prediction }}</p>
<p id="test" style="display: none;">test</p>
<!-- " -->
<!-- script -->
<script>
let lat = 35.15360080380171;
let lng = 126.80878276380653;
var mapContainer = document.getElementById("map"), // 지도를 표시할 div
mapOption = {
center: new kakao.maps.LatLng(lat, lng), // 지도의 중심좌표
level: 3 // 지도의 확대 레벨
};
// 지도를 생성합니다
var map = new kakao.maps.Map(mapContainer, mapOption);
</script>
</body>
<script>
// console.log("r");
// let r = $()
// console.log(r);
</script>
test.html을 불렀을 때 API가 적용되지 않아요 . 해결방법이 있을까요