亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Flask Post 方法 405

Flask Post 方法 405

Go
ITMISS 2022-12-26 10:00:27
為什么不調用 Post 方法我只能使用 get 方法@Admin.route("/upload-image",methods=["GET", 'POST']) def upload_image():if request.method == 'POST':    if request.files:        pdf = request.files["pdf"]        print(pdf)        return redirect()return '''<form action="/Admin/upload-image" method='POST'>    <div class="form-group">      <label>Select PDF</label>      <div class="custom-file">        <input type="file" class="custom-file-input" name="pdf" id="pdf">        <label class="custom-file-label" for="image">Select PDF</label>      </div>    </div>    <button type="submit" class="btn btn-primary">Upload</button>  </form>'''
查看完整描述

1 回答

?
一只名叫tom的貓

TA貢獻1906條經驗 獲得超3個贊

我在我的項目中遇到了類似的問題,這是我找到的解決方案:-)


獲取登錄調用


@app.route("/login")

   def getCall():

     response = {}

     response['result'] = '0'

     response['messege'] = 'response from get'

     return response

發布登錄請求


@app.route("/login", methods=['POST'])

def postCall():

 response = {}

 response['result'] = '0'

 response['messege'] = 'response from post'

 return response


查看完整回答
反對 回復 2022-12-26
  • 1 回答
  • 0 關注
  • 73 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號