Coding a database from Flask in VSCode. Help!

I watched the video on how to set up a virtual flask environment on my local machine and then this one right here where you create a todo list with a database.

This is the second time that I’ve watched it. Everything seemed to work. Everything except for the final step when you enter a todo and watch it get stored in the database. Instead of working properly, the browser sent this message:

Bad Request
The browser (or proxy) sent a request that this server could not understand.

I am very sure that I got all of the correct code and extensions.
If you guys need to see my code, I’ll be happy to provide it.


Have you tried running it from a terminal to troubleshoot?
In the terminal (make sure you’re in the right directory):

$ export FLASK_APP="" #or whatever your main file is``
$ export FLASK_DEBUG=1
$ flask run

This will run a local development server for your app. Copy and paste the url (it’s probably http://localhost:5000/) and see how your to-do app is running and what kind of error messages it spits out.

I don’t use vs code so I don’t know how the debug would work on it but there should be some way. Either way this will point you closer to the error in your code.

1 Like

The way I ran it was by typing the cod flask run in the terminal. Everything worked fine until I submitted the form.

Yes but I mean the debug mode this way gives you a detailed error message (for example, what was the line of code that prompted the “bad request”). Alternatively you can share your code here or through github link and see if anybody catches the error.

1 Like

Okay, thanks for your help. I’ll try to take it from here.

Thank you so much for the help! I fixed it!

Great! What was the issue?

Just a misspelled string and an unused variable. My bad.