Joey0424 / app.py
Joey889's picture
Create app.py
87112ce verified
raw
history blame contribute delete
679 Bytes
from flask import Flask, render_template, request
import random
app = Flask(__name__)
scenes = [
"你來到一座森林,聽見遠處傳來野獸的咆哮聲。",
"一位老法師出現在你面前,問你是否願意接受試煉。",
"你在古老的遺跡裡發現一本泛黃的地圖……"
]
@app.route("/", methods=["GET", "POST"])
def index():
story = ""
if request.method == "POST":
action = request.form.get("action")
story = random.choice(scenes) + f" 你選擇了【{action}】,命運即將揭曉……"
return render_template("index.html", story=story)
if __name__ == "__main__":
app.run(host="0.0.0.0", port=7860)