This repository contains two Flask projects: LoginForm and Cafe. Each project focuses on different functionalities but shares a common Flask backend.
The primary goal of this project is to build advanced forms using Flask-WTF extension. This project introduces Flask developers to Flask-WTF for easy form validation, less code, and built-in CSRF protection.
The end result of this project is a website that holds some secrets. Access to these secrets is restricted by requiring the correct username and password.
This project aims to utilize Flask-WTF, Bootstrap-Flask, and Bootstrap classes to enhance the user experience of a website displaying cafe information. It also involves revising CSV manipulation skills.
- The home page should resemble the provided style using the
css/styles.css
. - The
/cafes
route should render a page (cafes.html
) with a Bootstrap table displaying data fromcafe-data.csv
. - The location URL should be rendered as an anchor tag within the table.
- Clicking "Show Me!" on the home page should navigate to
cafes.html
. - The secret route
/add
should renderadd.html
. - Use Flask-WTF's
render_form
to create a form inadd.html
with validation for the location URL. - Upon successful form submission, data should be appended to
cafe-data.csv
.
- Ensure all navigation links within the website are functional.
- Read more about Flask-WTF here.
- Bootstrap-Flask documentation can be found here.
- For URL validation, refer to WTForms validators documentation.
- Switch off client-side validation with
quick_forms
as per this Stack Overflow post.
- Clone the repository.
- Navigate to the project directory (
LoginForm
orCafe
). - Install dependencies (
pip install -r requirements.txt
). - Run the Flask application (
python app.py
).