CS50 Flask not working in vscode but working in cs50ide

Viewed 550

I'm currently working on week 9 of cs50 and i'm a little bit confused of flask in vscode web. If I run this code:

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"))

in vscode with "flask run" and follow the link I get the error "Bad request 400"

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

But if I run the same code in the same way in cs50ide its working just fine

I would really like to work with vscode. So it would be great if someone could help me with this

1 Answers

I had the same problem, please make sure whether the port is available for the link. If not, you may try web codespace, not the desktop version. cleaning the browser's cache and cookies works for me.

check this out: https://en.ryte.com/wiki/Status_Code_400

Related