This repository demonstrates the use of Flask-WTF, an extension of Flask that integrates with WTForms to handle form validation and rendering in Flask applications.
- Introduction
- Features
- Prerequisites
- Installation
- Usage
- Project Structure
- Forms
- Routes
- Contributing
- License
Flask-WTF simplifies working with forms in Flask applications by providing a set of tools for form validation, CSRF protection, and rendering HTML forms. This demo project showcases how to create forms, validate user inputs, and handle form submissions securely using Flask-WTF.
- Form Validation: Easily validate user input with built-in and custom validators.
- CSRF Protection: Automatically protect forms from Cross-Site Request Forgery (CSRF) attacks.
- Seamless Integration: Integrates seamlessly with Flask to handle forms and user inputs.
- Customizable Forms: Build and customize forms using WTForms' flexible form field types.
Before running this project, ensure you have the following installed:
- Python 3.x
- Flask
- Flask-WTF
-
Clone this repository:
git clone https://github.com/Mhatreyash/WTF-Flask.git cd flask-wtf-demo -
Create a virtual environment and activate it:
python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install the required dependencies:
pip install -r requirements.txt
-
Run the application:
flask run
- Access the application by navigating to
http://127.0.0.1:5000in your web browser. - Fill out the form and submit it.
- The server will validate the input and return the appropriate response.