
지금 팬명록 작업중인데
localhost:5000으로 접속하면 전에 작업하던 영화평점화면이 뜹니다
팬명록의 app.py는 오류없이 작동합니다
,
작성한 코드 및 에러 메세지
app.py
from flask import Flask, render_template, request, jsonify
app = Flask(__name__)
@app.route('/')
def home():
return render_template('index.html')
@app.route("/homework", methods=["POST"])
def homework_post():
sample_receive = request.form['sample_give']
print(sample_receive)
return jsonify({'msg':'POST 연결 완료!'})
@app.route("/homework", methods=["GET"])
def homework_get():
return jsonify({'msg':'GET 연결 완료!'})
if __name__ == '__main__':
app.run('0.0.0.0', port=5000, debug=True)
index.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"
integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
crossorigin="anonymous"></script>
<title>스파르타코딩클럽 | 부트스트랩 연습하기</title>
<style>
.mytitle {
background-image:linear-gradient(0deg, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url('/10cm.jpg');
background-size:cover;
background-position: center;
width:100%;
height:250px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
color:white;
}
.mytitle > button{
background-color:transparent;
color:white;
border:1px solid white;
}
.topbox {
width:95%;
max-width:500px;
margin:20px auto 20px auto;
padding:20px;
box-shadow: 0px 0px 3px 0px black;
}
.topbox > button {
margin-top:15px;
}
.card {
max-width:500px;
display:flex;
margin: 20px auto 20px auto;
}
.button {
width:120px;
height:40px;
background-color:black;
color:white;
border-radius:10px;
}
</style>
<script>
function temper(){
$('#mytitle_btn').empty()
$.ajax({
type:'GET',
url:"http://spartacodingclub.shop/sparta_api/weather/seoul",
data:{},
success:function(response){
let gion = response['temp']
temp_html =`현재기온:${gion}`
$('#mytitle_btn').append(temp_html)
}
})
}
</script>
</head>
<body>
<div class="mytitle">
<h1>십센치(10cm) 팬명록</h1>
<button id="mytitle_btn" onclick="temper()">현재기온:</button>
</div>
<div class="topbox">
<div class="form-floating mb-3">
<input type="text" class="form-control" id="floatingInput" placeholder="text">
<label for="floatingInput">닉네임</label>
</div>
<div class="form-floating">
<textarea class="form-control" placeholder="Leave a comment here" id="floatingTextarea"></textarea>
<label for="floatingTextarea">Comments</label>
</div>
<button onclick="save_comment()" type="button" class="button">응원남기기</button>
</div>
<div class="card">
<div class="card-body">
<blockquote class="blockquote mb-0">
<p>새로운 앨법 응원해요!</p>
<footer class="blockquote-footer">호빵맨</footer>
</blockquote>
</div>
</div>
<div class="card">
<div class="card-body">
<blockquote class="blockquote mb-0">
<p>새로운 앨법 응원해요!</p>
<footer class="blockquote-footer">호빵맨</footer>
</blockquote>
</div>
</div>
<div class="card">
<div class="card-body">
<blockquote class="blockquote mb-0">
<p>새로운 앨법 응원해요!</p>
<footer class="blockquote-footer">호빵맨</footer>
</blockquote>
</div>
</div>
</body>
</html>
