A comprehensive health and fitness tracking web application built with Django. Track your weight, set goals, monitor progress, and get personalized health advice!
- Secure Registration & Login - Create your account and log in securely
- Profile Management - Edit your name, email, and personal information
- Password Protection - Django's built-in authentication system
- Record Weight Entries - Track your weight over time with dates and notes
- Weight History - View all your past weight entries in a clean table
- BMI Calculation - Automatic BMI calculation and categorization
- Progress Charts - Beautiful Chart.js line graphs showing weight trends
- Set Weight Goals - Define your target weight (lose, gain, or maintain)
- Choose Your Pace - Slow, moderate, or fast weight loss/gain plans
- Timeline Calculator - Automatic calculation of:
- Weeks to goal
- Target completion date
- Current progress percentage
- Weekly weight change rate
- Overview Statistics - Current weight, BMI, target weight, height
- Progress Tracking - Visual progress bars and circular progress indicators
- Weight Trend Chart - Interactive line chart showing your weight over time
- Goal Timeline - See how close you are to achieving your goals
- Diet & Nutrition Advice - Get curated tips on healthy eating
- Meal Prep Ideas - Practical meal planning and preparation guides
- Workout Tips - Exercise routines for all fitness levels
- YouTube Recommendations - Links to top fitness channels
- Motivational Support - Inspiring quotes and encouragement
- Personalized Responses - Advice based on your profile and goals
- Responsive Design - Works perfectly on desktop, tablet, and mobile
- Bootstrap 5 - Clean, professional interface with gradients
- Floating Chat Widget - Facebook Messenger-style chat button
- Smooth Animations - Card hover effects and transitions
- Color-Coded Stats - Easy-to-read BMI categories with badges
- Python 3.8 or higher
- pip (Python package manager)
- Virtual environment (recommended)
-
Clone the Repository
git clone https://github.com/AndrewTr0612/DjangoTestingHealthApp.git cd DjangoTestingHealthApp -
Set Up Virtual Environment
cd project python -m venv .venv # On Linux/Mac: source .venv/bin/activate # On Windows: .venv\Scripts\activate
-
Install Dependencies
pip install -r src/requirements.txt
-
Set Up Environment Variables
cd src cp .env.example .env # Or create .env file manually
Edit
.envfile:SECRET_KEY=your-secret-key-here DEBUG=True ALLOWED_HOSTS=localhost
-
Run Migrations
python manage.py migrate
-
Create Superuser (Optional)
python manage.py createsuperuser
-
Start Development Server
python manage.py runserver
-
Access the Application
- Open your browser and go to:
http://localhost:8000 - Register a new account or login
- Start tracking your health!
- Open your browser and go to:
DjangoTestingHealthApp/
βββ project/
β βββ .venv/ # Virtual environment
β βββ src/
β βββ manage.py # Django management script
β βββ requirements.txt # Python dependencies
β βββ db.sqlite3 # SQLite database
β βββ .env # Environment variables
β βββ account/ # Main app
β β βββ models.py # Database models
β β βββ views.py # View functions
β β βββ forms.py # Django forms
β β βββ urls.py # URL routing
β β βββ admin.py # Admin configuration
β βββ chatbox/ # Chatbot functionality
β β βββ gpt.py # Health advice service
β β βββ views.py # Chatbot views
β βββ healthtracker/ # Project settings
β β βββ settings.py # Django settings
β β βββ urls.py # Main URL config
β β βββ wsgi.py # WSGI config
β βββ templates/ # HTML templates
β β βββ base.html # Base template
β β βββ accounts/ # Account templates
β βββ static/ # Static files
β βββ css/ # Stylesheets
β βββ js/ # JavaScript
βββ README.md # This file
βββ QUICKSTART.md # Quick setup guide
- User (OneToOne with Django User)
- Height (cm)
- Date of Birth
- Gender (Male/Female/Other)
- Auto-calculated Age
- User (ForeignKey)
- Weight (kg)
- Recorded Date
- Notes (optional)
- Auto-calculated BMI
- Auto-categorized BMI Category
- User (OneToOne)
- Goal Type (Lose/Gain/Maintain)
- Target Weight (kg)
- Pace (Slow/Moderate/Fast)
- Created Date
- Methods: calculate_timeline(), get_target_date(), get_progress_percentage()
- User (ForeignKey)
- Message
- Response
- Timestamp
- Click "Register" and create your account
- Fill in your height, gender, and date of birth
- Complete your profile setup
- Navigate to "Add Weight"
- Enter your current weight
- Select the date (defaults to today)
- Add optional notes
- Click "Set Goal"
- Choose your goal type (lose/gain/maintain weight)
- Enter your target weight
- Select your preferred pace
- View automatic timeline calculations
- Visit your Dashboard to see:
- Current weight and BMI
- Progress towards goal
- Weight trend chart
- Timeline estimate
- Add new weight entries regularly
- Watch your progress graph update!
- Click the blue chat button (bottom-right corner)
- Ask questions like:
- "What should I eat for weight loss?"
- "Give me a workout plan"
- "Show me meal prep ideas"
- "I need motivation"
- Get instant, curated health advice!
- Django 5.2.7 - Python web framework
- SQLite - Database (development)
- Python 3.12 - Programming language
- Bootstrap 5.3.0 - CSS framework
- Chart.js 4.4.0 - Interactive charts
- Bootstrap Icons - Icon library
- Vanilla JavaScript - Client-side functionality
- python-decouple - Environment variable management
- Django Auth - User authentication
- Django Forms - Form handling
View your health stats, progress, and weight trends in one place.
Log your weight entries and see your progress over time with interactive charts.
Set realistic goals and get automatic timeline calculations.
Get instant advice on diet, workouts, and meal prep through the floating chatbox.
- Underweight: BMI < 18.5
- Normal: BMI 18.5 - 24.9
- Overweight: BMI 25.0 - 29.9
- Obese: BMI β₯ 30.0
- Calculates weeks to goal based on safe weight loss/gain rates
- Slow pace: 0.25 kg/week
- Moderate pace: 0.5 kg/week
- Fast pace: 1.0 kg/week
- Shows target completion date
- Tracks progress percentage
- Diet: Nutrition tips, calorie advice, healthy eating
- Workouts: Exercise routines, strength training, cardio
- Meal Prep: Weekly meal planning, batch cooking
- YouTube: Fitness channel recommendations
- Motivation: Inspirational quotes and support
- BMI: Personalized advice based on your BMI category
- CSRF protection on all forms
- Password hashing with Django's built-in system
- Login required decorators on sensitive views
- Session-based authentication
- XSS protection
- SQL injection prevention (Django ORM)
- Set
DEBUG=Falsein.env - Generate a strong
SECRET_KEY - Configure
ALLOWED_HOSTS - Use PostgreSQL or MySQL instead of SQLite
- Set up static file serving
- Use a production WSGI server (Gunicorn, uWSGI)
- Enable HTTPS
- Configure proper logging
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Andrew
- GitHub: @AndrewTr0612
- Django Documentation
- Bootstrap Team
- Chart.js Contributors
- Stack Overflow Community
- All fitness YouTubers for inspiration
If you have any questions or run into issues:
- Check the QUICKSTART.md guide
- Review the code comments
- Open an issue on GitHub
- Contact the author
Start your fitness journey today with Health Tracker! πͺπ₯
Remember: Consistency is key. Small progress is still progress! π