A simple Flask application with user authentication using JWT (JSON Web Tokens) and MySQL for data storage.
- User registration and login
- JWT-based authentication
- MySQL database integration
- Password hashing (using Werkzeug)
- Utility functions (
utils.py
) - Environment-safe configuration
/project-root ├── app.py ├── requirements.txt ├── .env ├── /templates │ ├── index.html │ ├── login.html │ └── dashboard.html ├── /static │ └── cal.jpg (optional) └── /Project └── utils.py
git clone https://github.com/your-username/your-repo-name.git cd your-repo-name
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
Create a .env file in the project root directory to store environment variables (do not commit this file to version control).
Example .env:
env
Copy
Edit
JWT_SECRET_KEY=your-secret-key
MYSQL_HOST=localhost
MYSQL_USER=root
MYSQL_PASSWORD="yourpassword"
MYSQL_DB=mydatabase
This .env file is loaded automatically by the app using python-dotenv.
source path/to/database.sql
python app.py
Method Route Description POST /register User registration POST /login User login GET /protected JWT-protected endpoint