Habit Tracker is a web application that helps users track their daily habits. Users can register, log in, add habits, mark them as completed, and receive daily email reminders to complete their habits.
- User registration and login
- Add, view, and complete habits
- Track habit streaks
- Categorize habits
- Toggle dark mode
- Receive daily email reminders
- Flask (Python web framework)
- Flask-SQLAlchemy (ORM for database management)
- Flask-Login (User session management)
- Flask-Mail (Sending email reminders)
- APScheduler (Scheduling tasks)
- Bootstrap (CSS framework for styling)
- Chart.js (JavaScript library for charts)
-
Clone the repository:
git clone https://github.com/your-username/habit-tracker.git cd habit-tracker -
Create a virtual environment:
python -m venv venv
-
Activate the virtual environment:
-
On Windows:
venv\Scripts\activate
-
On macOS/Linux:
source venv/bin/activate
-
-
Install the required packages:
pip install -r requirements.txt
-
Set up the database:
flask db init flask db migrate -m "Initial migration." flask db upgrade -
Configure environment variables:
Create a
.envfile in the root directory and add the following:FLASK_APP=app.py FLASK_ENV=development SECRET_KEY=your_secret_key SQLALCHEMY_DATABASE_URI=sqlite:///habits.db MAIL_SERVER=smtp.gmail.com MAIL_PORT=587 MAIL_USE_TLS=True MAIL_USERNAME=your-email@gmail.com MAIL_PASSWORD=your-email-password
Replace
your-email@gmail.comandyour-email-passwordwith your actual Gmail email address and password.
-
Run the application:
flask run
-
Open the application in your web browser:
Navigate to
http://127.0.0.1:5000/in your web browser. -
Register a new user:
- Go to the registration page (
http://127.0.0.1:5000/register) and create a new account.
- Go to the registration page (
-
Log in:
- Log in with your newly created account (
http://127.0.0.1:5000/login).
- Log in with your newly created account (
-
Add and manage habits:
- Add new habits, mark them as completed, and track your progress.
-
Toggle dark mode:
- Use the "Toggle Dark Mode" button to switch between light and dark themes.
-
Receive email reminders:
- The application will send daily email reminders to complete your habits.
To manually trigger email reminders for testing purposes, navigate to http://127.0.0.1:5000/test_reminders in your web browser.
This project is licensed under the MIT License. See the LICENSE file for details.
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.