我有這個Python代碼。每當我啓動webbserver並轉到網站時,我不會收到「測試」消息,只是發現內部服務器錯誤。怎麼來的?我究竟做錯了什麼。每當我去的網站的GET請求權,所以它應該進入域()函數,給我的文字「測試」GET請求在Python中不起作用
@app.route("/", methods=['GET', 'POST'])
def hello():
if request.method == 'GET':
domain()
else:
test()
def domain():
return "test"
def test():
data = request.get_json()
with open("text.txt", "w") as text_file:
pickle.dump(data, text_file)
if __name__ == "__main__":
app.run()
由於它的工作!我已經進口了,我只是沒想到,我需要表現出來,但換來的是這個問題。將盡快接受它作爲答案!謝謝! – 2014-10-19 12:22:44