In the directory you created, create a simple flask app with the following features: Main page should have an HTML form that allows the user to enter the name of a TV show (no need to check if it’s a real TV show). This TV show should be saved in a list of favorites. If it’s already in the list, nothing should happen. Main page should have a second HTML form that allows the user to enter the name of a TV show. This TV show should be deleted from the list of favorites. If it’s not in the list, nothing should happen. Main page should display the statement “You have X saved TV shows”, where X is the number of TV shows the user has saved, as well as a list of the saved shows. The number should increment when a new show is entered, and decrement when a show is deleted (this requires a page refresh)
- In the directory you created, create a simple flask app with the following features:
- Main page should have an HTML form that allows the user to enter the name of a TV show (no need to check if it’s a real TV show). This TV show should be saved in a list of favorites. If it’s already in the list, nothing should happen.
- Main page should have a second HTML form that allows the user to enter the name of a TV show. This TV show should be deleted from the list of favorites. If it’s not in the list, nothing should happen.
- Main page should display the statement “You have X saved TV shows”, where X is the number of TV shows the user has saved, as well as a list of the saved shows. The number should increment when a new show is entered, and decrement when a show is deleted (this requires a page refresh)
- Create a .env file with your
database URL and save it there. Your database URL shouldn’t be written anywhere in your actual Python code. As always, your .gitignore should make sure your .env file isn’t pushed to GitHub. - Turn in a GitHub repo containing the Flask app from above on Gradescope.
Flask is a small and lightweight Python web framework that provides useful tools and features that make creating web applications in Python easier. It gives developers flexibility and is a more accessible framework for new developers since you can build a web application quickly using only a single Python file. Flask is also extensible and doesn’t force a particular directory structure or require complicated boilerplate code before getting started.
As part of this tutorial, you’ll use the Bootstrap toolkit to style your application so it is more visually appealing. Bootstrap will help you incorporate responsive web pages in your web application so that it also works well on mobile browsers without writing your own HTML, CSS, and JavaScript code to achieve these goals. The toolkit will allow you to focus on learning how Flask works.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps