# Flask Login Application
This Flask application demonstrates user registration and login functionality with basic validation. It uses a CSV file to store user data and provides a simple web interface styled with Bootstrap.
## Features
- **User Registration**: Users can register with an email and password.
- **User Login**: Users can log in using their registered email and password.
- **Validation**: Checks for empty fields, valid email format, and password length.
- **CSV Storage**: User data is stored in a CSV file (`user_data.csv`).
## Project Structure
/your-flask-app /static /css style.css /templates about.html contact.html home.html login.html register.html success.html app.py requirements.txt README.md
## Installation
1. **Clone the Repository**
Start by cloning the repository to your local machine. Open your terminal and run:
```bash
git clone https://github.com/your-username/your-flask-app.git
cd your-flask-app
-
Create a Virtual Environment A virtual environment is a self-contained directory that contains a Python installation and additional packages. It helps to manage dependencies for your project without affecting the global Python environment. To create a virtual environment, run:
python -m venv venv
Here,
venv
is the name of the virtual environment directory. You can choose a different name if you prefer. -
Activate the Virtual Environment Activating the virtual environment will allow you to use the installed packages in that environment. Depending on your operating system, the command to activate the virtual environment varies:
- On Windows:
venv\Scripts\activate
- On macOS/Linux:
After activation, your terminal prompt should change to indicate that the virtual environment is active.
source venv/bin/activate
- On Windows:
-
Install Dependencies With the virtual environment activated, install the necessary packages using the
requirements.txt
file. Run:pip install -r requirements.txt
This command will install all the dependencies listed in the
requirements.txt
file, including Flask and any other packages required for the project. -
Run the Application Finally, run the Flask application with:
python app.py
The application will start and be available at
http://127.0.0.1:7000/
.
- Home Page: Accessible at
/
and displays a home page. - About Page: Accessible at
/about
and displays information about the application. - Contact Page: Accessible at
/contact
with contact information. - Register Page: Accessible at
/register
for user registration. - Login Page: Accessible at
/login
for user login. - Success Page: Accessible at
/success
to show a success message after login.
- Email: Must be a valid email address.
- Password: Must be more than 8 characters.
The user data is stored in user_data.csv
. The file is automatically created if it does not exist. The CSV file will have the following columns:
email
password
- Missing CSV File: The CSV file is created automatically before handling any requests. Ensure you have the correct Flask version.
- Validation Errors: Check if you are using valid email addresses and passwords that meet the length requirement.
Feel free to fork the repository, make changes, and submit a pull request. Any improvements or bug fixes are welcome.
This project is licensed under the MIT License. See the LICENSE file for details.
- Flask Documentation
- Bootstrap Documentation
This markdown provides a comprehensive guide for your Flask application, including installation instructions, usage details, project structure, and other relevant information. It's well-structured and should be easy for users to follow.