You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
742 B
21 lines
742 B
1 month ago
|
from flask import Flask, jsonify, send_from_directory
|
||
|
app = Flask(__name__, static_folder="public", static_url_path="")
|
||
|
@app.route("/")
|
||
|
def serve_index():
|
||
|
return send_from_directory(app.static_folder, "index.html")
|
||
|
@app.route("/api/data")
|
||
|
def api_data():
|
||
|
data = {
|
||
|
"product_name": "古新枣木梳",
|
||
|
"description": "采用古新枣木手工打造,质地坚硬,纹理美观,传承千年工艺。",
|
||
|
"benefits": [
|
||
|
"天然材质,温和护发",
|
||
|
"手工雕刻,工艺精湛",
|
||
|
"传承文化,寓意吉祥"
|
||
|
],
|
||
|
"price": "¥99",
|
||
|
"image_url": "/images/comb.jpg"
|
||
|
}
|
||
|
return jsonify(data)
|
||
|
if __name__ == "__main__":
|
||
|
app.run(debug=True, port=80)
|