commit da905675e7012f2fa5705c8ab8e8cc18cc741ff9 Author: jc <419690370@qq.com> Date: Mon Mar 10 22:16:08 2025 +0800 first commit diff --git a/app.py b/app.py new file mode 100644 index 0000000..c1ffd07 --- /dev/null +++ b/app.py @@ -0,0 +1,26 @@ +from flask import Flask, jsonify + +app = Flask(__name__, static_folder="public", static_url_path="/static") + + +# 根路径返回 index.html +@app.route("/") +def serve_index(): + return app.send_static_file("index.html") + + +# API 子路径,提供数据 +@app.route("/api/data") +def api_data(): + return jsonify({ + "message": "Welcome to Beijing Wildlife Park", + "data": [ + {"name": "Panda", "description": "Giant panda native to China"}, + {"name": "Giraffe", "description": "The tallest land animal"}, + {"name": "Elephant", "description": "The largest land animal"} + ] + }) + + +if __name__ == "__main__": + app.run(debug=True, port=80) \ No newline at end of file diff --git a/project-folder/public/insex.html b/project-folder/public/insex.html new file mode 100644 index 0000000..3652abf --- /dev/null +++ b/project-folder/public/insex.html @@ -0,0 +1,18 @@ + + + + + Beijing Wildlife Park + + + +

Beijing Wildlife Park

+ Wildlife in Beijing +

Welcome to Beijing Wildlife Park, home to a variety of animals.

+

Animals

+ + + + \ No newline at end of file diff --git a/project-folder/public/static/beijing-wildlife.jpg b/project-folder/public/static/beijing-wildlife.jpg new file mode 100644 index 0000000..c5dc046 Binary files /dev/null and b/project-folder/public/static/beijing-wildlife.jpg differ diff --git a/project-folder/public/static/index.html b/project-folder/public/static/index.html new file mode 100644 index 0000000..3652abf --- /dev/null +++ b/project-folder/public/static/index.html @@ -0,0 +1,18 @@ + + + + + Beijing Wildlife Park + + + +

Beijing Wildlife Park

+ Wildlife in Beijing +

Welcome to Beijing Wildlife Park, home to a variety of animals.

+

Animals

+ + + + \ No newline at end of file diff --git a/project-folder/public/static/script.js b/project-folder/public/static/script.js new file mode 100644 index 0000000..98391c3 --- /dev/null +++ b/project-folder/public/static/script.js @@ -0,0 +1,14 @@ +document.addEventListener('DOMContentLoaded', function() { + const animals = [ + { name: "Panda", description: "Giant panda native to China" }, + { name: "Giraffe", description: "The tallest land animal" }, + { name: "Elephant", description: "The largest land animal" } + ]; + + const animalListElement = document.getElementById('animal-list'); + animals.forEach(animal => { + const li = document.createElement('li'); + li.textContent = `${animal.name} - ${animal.description}`; + animalList.appendChild(li); + }); +}); \ No newline at end of file diff --git a/project-folder/public/static/style.css b/project-folder/public/static/style.css new file mode 100644 index 0000000..d78a0ae --- /dev/null +++ b/project-folder/public/static/style.css @@ -0,0 +1,31 @@ +body { + font-family: Arial, sans-serif; + background-color: #f8f4f9; + color: #333; + margin: 0; + padding: 20px; +} + +h1 { + color: #d4ea; + text-align: center; +} + +img { + max-width: 100%; + height: auto; +} + +a { + color: #d4ea; + text-decoration: none; +} + +a:hover { + text-decoration: underline; +} + +#animal-list li { + list-style-type: none; + margin-bottom: 10px; +} \ No newline at end of file