How divyam1708/personal_expense_tracker works
1. Purpose and Runtime
This is a Django personal expense tracker with account registration/login and expense browsing/detail views. It runs through Django’s management and deployment entry points: manage.py, personal_expense_tracker/wsgi.py, and personal_expense_tracker/asgi.py.
2. Project Composition and Routing
The project root configures Django and composes application URLs. personal_expense_tracker/settings.py defines runtime configuration, while personal_expense_tracker/urls.py routes requests into the account and expense domains. The two primary Django apps are accounts/ and expenses/.
3. Account and Authentication Domain
The accounts app owns user-facing identity flows: registration, login, and authenticated-state pages. Request handlers and route definitions reside in accounts/views.py and accounts/urls.py; account persistence is defined in accounts/models.py. HTML rendering is backed by templates/accounts/Register.html, templates/accounts/Login.html, and templates/accounts/Logged_in.html.
4. Expense Domain
The expenses app is the core business domain: it models expense records, accepts/forms expense-related input, and exposes views for home, daily, monthly, and individual-expense detail screens. Its principal boundary is expenses/models.py, with request orchestration in expenses/views.py and route declarations in expenses/urls.py. Main presentation surfaces are templates/expenses/home.html, templates/expenses/DayBasedExpense.html, templates/expenses/MonthBasedExpense.html, and templates/expenses/ExpenseDetail.html.
5. Primary Request and Data Flow
Browser requests enter Django through ASGI or WSGI, are matched by personal_expense_tracker/urls.py, then dispatched to app views. Views use forms and models to validate input and read/write database-backed entities: accounts/forms.py / accounts/models.py for identity operations and expenses/forms.py / expenses/models.py for expense operations. Views render server-side Django templates, with shared layout and error boundaries in templates/base/Base_1.html and templates/base/Error_1.html.
6. Persistence and Schema Evolution
Django ORM models are the persistence abstraction; the backing database is selected through project settings rather than visible in the tree. Schema history is maintained independently per domain in accounts/migrations/0001_initial.py and expenses/migrations/0001_initial.py. Django admin integration is present in accounts/admin.py and expenses/admin.py, providing an operational interface for managed models.
7. Front-End Assets and Deployment Considerations
The UI is server-rendered but augmented with app-specific static JavaScript and CSS. Shared assets live under static/base/, while expense screens use static/expenses/scripts/home_1.js, static/expenses/scripts/expense_details_1.js, and corresponding styles. Deployment can use either synchronous WSGI or asynchronous ASGI interfaces; no separate API service, queue, or external integration is evidenced by the repository tree. secret_notes/ec2_secrets.txt suggests EC2-related deployment secrets are stored in-repo and should be treated as a security boundary.
Main entry points: urls.py Project URL router · accounts/views.py Account views · expenses/views.py Expense views · settings.py Project settings
Components 21
Django Runtime
- Management entry point
manage.py - WSGI entry point
personal_expense_tracker/wsgi.py - ASGI entry point
personal_expense_tracker/asgi.py - Project settings · Selects the database and Django configuration.
personal_expense_tracker/settings.py - Project URL router
personal_expense_tracker/urls.py
Accounts Domain
- Account routes
accounts/urls.py - Account views · Handles registration, login, and authenticated pages.
accounts/views.py - Account forms
accounts/forms.py - Account models
accounts/models.py
Expenses Domain
- Expense routes
expenses/urls.py - Expense views · Serves home, daily, monthly, and detail screens.
expenses/views.py - Expense forms
expenses/forms.py - Expense models
expenses/models.py
Server-rendered UI
- Account templates
templates/accounts/Register.html - Expense templates
templates/expenses/home.html - Shared layout & errors
templates/base/Base_1.html - Static assets · Shared and expense-screen client assets.
Persistence & Operations
- Configured database · Database engine is selected in project settings.
- Schema migrations · Each domain maintains its initial schema migration.
accounts/migrations/0001_initial.py - Django admin · Registers managed account and expense models.
accounts/admin.py - EC2 secrets file · In-repository deployment secrets require restricted handling.
secret_notes/ec2_secrets.txt
Connections 25
- Management entry point → Project settings: loads
- WSGI entry point → Project settings: boots
- ASGI entry point → Project settings: boots
- Project settings → Project URL router: configures
- WSGI entry point → Project URL router: HTTP requests
- ASGI entry point → Project URL router: HTTP requests
- Project URL router → Account routes: includes
- Project URL router → Expense routes: includes
- Account routes → Account views: dispatches
- Expense routes → Expense views: dispatches
- Account views → Account forms: validates input
- Account views → Account models: reads and writes
- Expense views → Expense forms: validates input
- Expense views → Expense models: reads and writes
- Account models → Configured database: persists via ORM
- Expense models → Configured database: persists via ORM
- Schema migrations → Account models: defines initial schema
- Schema migrations → Expense models: defines initial schema
- Django admin → Account models: manages
- Django admin → Expense models: manages
- Account views → Account templates: renders
- Expense views → Expense templates: renders
- Account templates → Shared layout & errors: uses layout
- Expense templates → Shared layout & errors: uses layout
- Expense templates → Static assets: loads assets