【问题标题】:CS50 Flask not working in vscode but working in cs50ideCS50 Flask 在 vscode 中不工作,但在 cs50ide 中工作
【发布时间】:2022-01-15 15:32:20
【问题描述】:

我目前在 cs50 的第 9 周工作,我对 vscode web 中的烧瓶有点困惑。 如果我运行这段代码:

from flask import Flask, render_template, request

app = Flask(__name__)

@app.route("hello")
def index():
    return render_template("index.html", name=request.args.get("name"))

在带有“flask run”的 vscode 中并点击链接我收到错误“Bad request 400”

{"type":"https://tools.ietf.org/html/rfc7231#section-6.5.1","title":"Bad 
Request","status":400,"traceId":"|e2de7987-46bd8bcf98f5f413."}

但是如果我在 cs50ide 中以相同的方式运行相同的代码,它就可以正常工作

我真的很想使用 vscode。 所以如果有人可以帮助我,那就太好了

【问题讨论】:

    标签: visual-studio-code cs50


    【解决方案1】:

    我遇到了同样的问题,请确定该端口是否可用于链接。如果没有,您可以尝试 Web 代码空间,而不是桌面版本。清理浏览器的缓存和 cookie 对我有用。

    看看这个:https://en.ryte.com/wiki/Status_Code_400

    【讨论】:

      猜你喜欢
      • 2019-11-21
      • 2022-07-01
      • 1970-01-01
      • 2022-07-03
      • 1970-01-01
      • 2021-10-01
      • 2021-09-09
      • 2019-10-25
      • 2010-12-20
      相关资源
      最近更新 更多