最近中文字幕高清中文字幕无,亚洲欧美高清一区二区三区,一本色道无码道dvd在线观看 ,一个人看的www免费高清中文字幕

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

flask中到url重定向報(bào)錯(cuò),卻參數(shù),但不知道這個(gè)參數(shù)到底應(yīng)該是怎么傳送的

flask中到url重定向報(bào)錯(cuò),卻參數(shù),但不知道這個(gè)參數(shù)到底應(yīng)該是怎么傳送的

胖貓CAT 2019-11-27 11:04:33
from?flask?import?Flask,?url_for from?werkzeug.utils?import?redirect app?=?Flask(__name__) @app.route('/admin') def?hello_admin(): ???return?'Hello?Admin' @app.route('/guest/') def?hello_guest(guest): ???return?'Hello?%s?as?Guest'?%?guest @app.route('/user/') def?hello_user(name): ???if?name?=='admin': ??????return?redirect(url_for('hello_admin')) ???else: ??????return?redirect(url_for('hello_guest'),?guest?=?name) ???? if?__name__?==?'__main__': ???app.run(debug=True) 1、運(yùn)行??顯示?Hello?Admin?運(yùn)行正常 2、但是運(yùn)行??? 顯示如下錯(cuò)誤:TypeErrorTypeError:?hello_user()?missing?1?required?positional?argument:?'name' 3、再次運(yùn)行http://127.0.0.1:5000/user/admin 顯示如下錯(cuò)誤:Not?FoundThe?requested?URL?was?not?found?on?the?server.?If?you?entered?the?URL?manually?please?check?your?spelling?and?try?again. 4、再次運(yùn)行 顯示如下錯(cuò)誤:Not?FoundThe?requested?URL?was?not?found?on?the?server.?If?you?entered?the?URL?manually?please?check?your?spelling?and?try?again. 第3、4次運(yùn)行中是不是我的輸入是錯(cuò)誤導(dǎo)致的?那么參數(shù)應(yīng)該怎么傳呢? 5、因?yàn)橐陨洗a是教程中到源代碼,應(yīng)該是沒(méi)有錯(cuò)的。 后來(lái)我修改了源代碼中@app.route('/user/<name>')加入了<name>這個(gè)參數(shù)。 運(yùn)行??和??都顯示Hello?Admin?運(yùn)行正常。 但是運(yùn)行http://127.0.0.1:5000/user/kjkj 顯示如下錯(cuò)誤:TypeErrorTypeError:?redirect()?got?an?unexpected?keyword?argument?'guest' 請(qǐng)問(wèn)問(wèn)題到底出在哪里呢??
查看完整描述

1 回答

  • 1 回答
  • 0 關(guān)注
  • 1780 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)