A Django web app for meal and calorie tracking: sign up / sign in, a daily dashboard, log meals (preset foods or your own items with calories), browse history by date, progress charts, goals, and profile settings. Development uses SQLite.
- Python 3.10+ (recommended)
- Django 4.2 (see comment in
DjangoProject1/settings.py) - SQLite (
db.sqlite3)
| Path | Description |
|---|---|
/ |
Home: today’s meal lines, calorie total, notes |
/login/, /register/ |
Sign in and sign up |
/add-meal/ |
Log a meal: pick a catalog food, or enter a custom name + calories per serving (optional unit); meal type and quantity apply to either |
/historyrecord/ |
Meal history for a selected date |
/progress/ |
~7-day calorie trend vs goal |
/goals/ |
Goal-related summary |
/my-info/ |
Profile, change password, delete account |
/logout/ |
Sign out |
/admin/ |
Django admin (superuser required) |
Auth uses a session (user_id). Application users are AppUser records, separate from Django’s built-in User.
cd HealthBite
python3 -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activateThere is no requirements.txt in the repo yet; install Django 4.2 to match settings:
pip install "Django>=4.2,<5"python3 manage.py migrateThis applies all app migrations (including FoodItem.created_by for custom foods).
python3 manage.py createsuperuserpython3 manage.py runserverOpen http://127.0.0.1:8000/ in your browser.
- Catalog foods (
FoodItemwithcreated_byempty) are shared presets (e.g. seeded in migrations). Their names must be unique among catalog items. - Custom foods are created from the add-meal form: you enter a name, calories per serving, and optionally a serving unit (defaults to
serving). They are stored asFoodItemrows linked to yourAppUserviacreated_by, then reused in your dropdown for later meals. - If the custom name field is non-empty, that path is used and the catalog dropdown is ignored for that submit. If it is empty, choose an item from the dropdown when catalog items exist; if there are no catalog items yet, fill in the custom fields only.
- Admin URL: http://127.0.0.1:8000/admin/
- Under Core, you can inspect
AppUser,UserProfile,MealLog,MealLogItem,FoodItem, etc. FoodItemin admin showscreated_by: blank = catalog, set = user-defined. You can still add catalog rows in admin; users can add their own from/add-meal/without admin.- If there are no catalog foods yet, you can still log meals using only the custom-food fields, or add seed
FoodItemrows in admin / migrations.
HealthBite/
├── manage.py
├── DjangoProject1/ # project settings, root URLconf
├── core/ # main app: models, views, urls, admin, static
├── templates/core/ # HTML templates
└── db.sqlite3 # local SQLite (do not commit sensitive DBs to public repos)
DEBUG = Trueand the defaultSECRET_KEYare for local use only. Before production, follow the Django deployment checklist.- Sign-up / sign-in is a demo-style flow: passwords are stored in a
password_hashfield as plain text for this course-style app, not production-grade hashing. Do not deploy as-is.
If the repository has no license file, confirm with the maintainers before redistributing or reusing the code.