An open API service indexing awesome lists of open source software.

https://github.com/qwertyfusion/database-management-using-flask

This project implements a User Authentication System using MySQL Database connectivity and Flask.
https://github.com/qwertyfusion/database-management-using-flask

bootstrap css flask html mysql mysql-workbench

Last synced: over 1 year ago
JSON representation

This project implements a User Authentication System using MySQL Database connectivity and Flask.

Awesome Lists containing this project

README

          

# Flask Auth using MySQL Database

This project implements a User Authentication System using MySQL Database connectivity and Flask.

---

## 🚀 Features
- Implemented user authentication/registration form using Flask and the database.
- **New Users**: Register using the signup button.
- **Existing Users**: Login with their credentials.
- Inside, users can update their personal details and reset their passwords.
- Users can view their grades but cannot edit them personally.
- Built a **responsive frontend** for user interactions using Bootstrap.
- Implemented backend flask connectivity with MySQL database.

---

## 🖼️ Preview
![Home Page](./preview/home.png)

---

## 📜 License

Flask Auth is open-source and released under the **MIT License**.
See the [LICENSE](./LICENSE) file for more details.

---

## 🛠️ Get Started

### 1️⃣ Clone the Repository
```sh
git clone "https://github.com/QwertyFusion/Database-Management-Using-Flask"
cd Database-Management-Using-Flask
```

### 2️⃣ Backend Setup (Flask)

#### Create and Activate Virtual Environment (venv)
```sh
python -m venv venv # Create virtual environment
source venv/bin/activate # MacOS/Linux
venv\Scripts\activate # Windows
```

#### Install Dependencies
```sh
pip install -r requirements.txt
```

### 3️⃣ Database Setup (MySQL and MySQL Workbench)

#### Install MySQL Server and MySQL Workbench from official websites
```yaml
MySQL Server Download Link: https://dev.mysql.com/downloads/installer/
MySQL Workbench Download Link: https://dev.mysql.com/downloads/workbench/
```

#### In MySQL Workbench, create `user_management` database and use it
```sql
CREATE DATABASE user_management;
USE user_management;
```

#### In MySQL Workbench, create `user` table and `grades` table and use it
```sql
CREATE TABLE users (
id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(50) NOT NULL,
email VARCHAR(100) NOT NULL UNIQUE,
password VARCHAR(255) NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

CREATE TABLE grades (
id INT AUTO_INCREMENT PRIMARY KEY,
user_id INT NOT NULL,
subject VARCHAR(100) NOT NULL,
grade DECIMAL(5, 2) NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
);
```

#### In MySQL Workbench, insert into `grades` table after creating account using frontend. Do this before logging in.
```sql
INSERT INTO grades (user_id, subject, grade) VALUES (1, '', );
```

### 4️⃣ Environment Variables

#### Create `.env` similar to `.env.example` for Flask Backend connectivity with your MySQL Database server:
```env
SECRET_KEY=mysecretkey # Keep this same, no need to change or delete
MYSQL_HOST=YOUR_MYSQL_SERVER_HOST
MYSQL_USER=root
MYSQL_PASSWORD=YOUR_MYSQL_SERVER_PASSWORD
MYSQL_DB=user_management # Your Database name
```

### 5️⃣ Run the Project

#### Start the Flask Backend
```bash
python app.py # Ensure the virtual environment is activated
```

Now, open your browser and go to **http://127.0.0.1:5000** to start using Flask Auth! 🚀

---

## 🛠 Tools Used


  1. Visual Studio Code

  2. HTML

  3. CSS

  4. Bootstrap

  5. Flask

  6. MySQL

  7. MySQL Workbench

  8. Git & GitHub (Version Control)

---

## 🔗 Link to Tools



Visual Studio Code


HTML


CSS


Bootstrap


Flask


MySQL


MySQL Workbench


Git


GitHub

---

## 👨‍💻 Developer