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

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

python-flask 框架中的url_for

python-flask 框架中的url_for

收到一只叮咚 2018-08-06 07:10:29
comments = []@app.route("/", methods=["GET", "POST"])def index():    if request.method == "GET":      return render_template("index.html", comments=comments)    #如果是post:    comments.append(request.form["contents"])    return redirect(url_for('index'))場景還原:我的服務器沒開80端口,我用nginxlisten 81端口。利用flask框架(上述代碼)遇到url_for('index')定向到 xxx.cn。可是我需要定向到 xxx.cn:81,那么應該怎么寫?(手動訪問xxx.cn:81都是可以的。)我的Nginx配置server {         listen 81;         server_name 11.11.11.11;          location / {                         proxy_pass http://127.0.0.1:5000; # 這里是指向 gunicorn host 的服務地址            proxy_set_header Host $host;             proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;         }        }
查看完整描述

1 回答

  • 1 回答
  • 0 關注
  • 1607 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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