Spaces:
Sleeping
Sleeping
Upload 2 files
Browse files- app.py +19 -0
- requirements.txt +2 -0
app.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
from flask import Flask, render_template, request, jsonify
|
| 3 |
+
|
| 4 |
+
app = Flask(__name__)
|
| 5 |
+
|
| 6 |
+
@app.route("/")
|
| 7 |
+
def index():
|
| 8 |
+
return render_template("index.html")
|
| 9 |
+
|
| 10 |
+
@app.route("/log_location", methods=["POST"])
|
| 11 |
+
def log_location():
|
| 12 |
+
data = request.json
|
| 13 |
+
lat = data.get("lat")
|
| 14 |
+
lon = data.get("lon")
|
| 15 |
+
print(f"📍 使用者點擊座標: {lat}, {lon}")
|
| 16 |
+
return jsonify({"status": "received"})
|
| 17 |
+
|
| 18 |
+
if __name__ == "__main__":
|
| 19 |
+
app.run(host="0.0.0.0", port=7860)
|
requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
flask
|