Browse Source

frist commit

master
jc 3 months ago
commit
277af3aebb
  1. 10
      app.py
  2. 44
      static/css/style.css
  3. 4
      static/js/script.js
  4. 42
      templates/index.html

10
app.py

@ -0,0 +1,10 @@
from flask import Flask, render_template
app = Flask(__name__)
@app.route("/")
def serve_index():
return render_template("index.html")
if __name__ == "__main__":
app.run(debug=True, port=80)

44
static/css/style.css

@ -0,0 +1,44 @@
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f4;
}
header {
background-color: #333;
color: #fff;
padding: 1rem 0;
text-align: center;
}
main {
padding: 2rem;
}
h1, h2 {
color: #333;
}
ul {
list-style-type: none;
padding: 0;
}
ul li {
background: #fff;
margin: 0.5rem 0;
padding: 0.5rem;
border: 1px solid #ddd;
border-radius: 5px;
}
footer {
text-align: center;
padding: 1rem 0;
background-color: #333;
color: #fff;
position: fixed;
width: 100%;
bottom: 0;
}

4
static/js/script.js

@ -0,0 +1,4 @@
// 简单的交互示例:显示欢迎信息
window.onload = function() {
alert("欢迎来到北京游玩攻略网站!");
};

42
templates/index.html

@ -0,0 +1,42 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>北京游玩攻略</title>
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
</head>
<body>
<header>
<h1>北京游玩攻略</h1>
</header>
<main>
<section id="introduction">
<h2>简介</h2>
<p>北京是中国的首都,拥有丰富的历史文化遗产和现代化的城市风貌。无论是古老的故宫、长城,还是现代的鸟巢、水立方,都能让您感受到这座城市的独特魅力。</p>
</section>
<section id="attractions">
<h2>热门景点</h2>
<ul>
<li>故宫:明清两代的皇宫,世界文化遗产,拥有无数珍贵文物。</li>
<li>长城:世界七大奇迹之一,不到长城非好汉。</li>
<li>颐和园:中国古典园林的代表,湖光山色,美不胜收。</li>
<li>天坛:明清两代皇帝祭天、祈谷的场所,建筑宏伟。</li>
<li>鸟巢、水立方:2008年北京奥运会的标志性建筑。</li>
</ul>
</section>
<section id="tips">
<h2>游玩小贴士</h2>
<ul>
<li>提前预订景点门票,避免排队。</li>
<li>注意天气情况,合理安排行程。</li>
<li>品尝北京特色美食,如烤鸭、炸酱面等。</li>
</ul>
</section>
</main>
<footer>
<p>&copy; 2025 北京游玩攻略</p>
</footer>
<script src="{{ url_for('static', filename='js/script.js') }}"></script>
</body>
</html>
Loading…
Cancel
Save