Polaris is a stupid web app built with Flask that allows users to manage their tasks efficiently. It includes features such as user authentication (signup, login, logout), a dashboard to view tasks, and a responsive design styled with Bootstrap. The app is designed to demonstrate the integration of Flask with MySQL.
- User authentication (Signup, Login, Logout)
- Secure password storage using hashing
- Responsive design with Bootstrap
- AJAX-based form submission validated using request.form for better user experience
- MySQL database integration with stored procedures
- Python 3.7 or higher
- MySQL Server
- A virtual environment (optional but recommended)
-
Clone the Repository
git clone https://github.com/your-repo/JF-todolist.git cd JF-todolist -
Set Up a Virtual Environment
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install Dependencies Install the required Python packages using
pip:pip install -r requirements.txt
The
requirements.txtfile should include:- Flask
- Flask-MySQLdb
- Werkzeug
-
Set Up the Database
- Open the
mySQLdbsetup.sqlfile and execute the SQL commands in your MySQL client to create the database and tables:CREATE DATABASE IF NOT EXISTS JF_todolist_db; USE JF_todolist_db;
- This script also creates a stored procedure
sp_createUserfor user registration.
- Open the
-
Configure the Application
- Update the MySQL credentials in
app.py:app.config['MYSQL_HOST'] = 'localhost' app.config['MYSQL_USER'] = 'your_mysql_user' app.config['MYSQL_PASSWORD'] = 'your_mysql_password' app.config['MYSQL_DB'] = 'jf_todolist_db'
- Update the MySQL credentials in
-
Run the Application Start the Flask development server:
python app.py
The app will be available at
http://127.0.0.1:5000.
- The `app.py` file initializes the Flask app and configures MySQL integration using `Flask-MySQLdb`.
- Routes are defined for user authentication (`/signup`, `/login`, `/logout`), the dashboard (`/dashboard`), and the home page (`/`).
- The MySQL database is used to store user credentials securely.
- A stored procedure `sp_createUser` ensures that usernames are unique and handles user registration.
- Passwords are hashed using `generate_password_hash` from `Werkzeug` before storing them in the database.
- During login, `check_password_hash` is used to verify the password.
- All HTML templates (`index.html`, `login.html`, `signup.html`, `dashboard.html`) are styled using Bootstrap for a responsive and modern UI.
- Navigation bars, forms, and buttons are built with Bootstrap components.
- The `ajax.js` file handles the signup form submission using the Fetch API.
- It sends form data validated using request.form to the server asynchronously and displays success or error messages dynamically.
- Jinja2 templates are used to render dynamic content, such as error messages and user-specific data.
- Flash messages are displayed for feedback on user actions.
JF-todolist/
├── app.py # Main Flask application
├── templates/ # HTML templates
│ ├── index.html
│ ├── login.html
│ ├── signup.html
│ ├── dashboard.html
├── static/ # Static files (JS only)
│ ├── main.js
│ ├── ajax.js
├── mySQLdbsetup.sql # SQL script for database setup
├── requirements.txt # Python dependencies
└── README.md # Project documentation
- Add task management features (CRUD operations for tasks).
- Implement user-specific task filtering and sorting.
- Ensure MySQL is running before launching the app. you can setup a local server for this using Xampp.
- If you encounter database issues, verify the mySQLdbsetup.sql script was executed properly.
This project is for educational purposes. Feel free to modify and expand it!
John FA - 2025