A clean, modern web application for tracking vehicle mileage and fuel costs. Built with Django and styled with Tailwind CSS.
The main landing page provides a quick overview of your current month's activity:
- Total Mileage: Sum of distances for the current month.
- Quick Links: Fast access to add a journey or view reports.
- Recent Activity: A glance at the latest logged trips.
Log a new trip with ease:
- Date: Defaults to today.
- Distance: Enter the trip distance (km/miles).
- Reason: Classify the trip (e.g., Business, Personal, Medical).
- Fuel Type: Auto-filled from your settings, but customizable per trip.
- Cost: Calculated automatically based on distance and fuel rates, or manually overrideable.
Manage your fuel reimbursement rates:
- Update per-unit costs for different fuel types (e.g., Petrol, Diesel, Electric).
- These rates are used to automatically calculate trip costs.
View and filter your entire trip log:
- Filters: Filter by Month and Year.
- Details: See distance, date, reason, and cost for every trip.
- Edit: Click any trip to edit its details.
Configure global application preferences:
- Default Fuel Type: Set your preferred fuel type for quicker data entry.
- Currency: Set your local currency symbol (e.g., $, €, £).
Visualize your data:
- Cost Distribution: View a breakdown of costs by fuel type.
- Monthly Summary: Consolidated view of monthly mileage and expenses.
By default, the application creates a superuser account on startup using the environment variables defined in docker-compose.yml:
- Default Username:
admin - Default Password:
admin
To change these, update the DJANGO_SUPERUSER_ variables in your docker-compose.yml and restart the containers.
You can create additional superusers or manage existing ones using the Django administrative commands.
docker-compose exec web python manage.py createsuperuserpython manage.py createsuperuserFor advanced user management (e.g., adding regular users, changing permissions, or deleting records manually), access the Django Admin interface at:
http://localhost:8000/admin
This project is containerized using Docker and Docker Compose for easy deployment.
- Build and Run:
docker-compose up --build -d
- Access: Open http://localhost:8000 in your browser.
The database will be automatically created and migrated on first launch.
The application is configured via environment variables defined in docker-compose.yml.
| Variable | Description | Default / Example |
|---|---|---|
PROD |
Critical. Set to True for production mode. Enables persistent database storage in data/ volume. |
True |
DEBUG |
Django debug mode. Set to False in production. |
False |
DJANGO_SECRET_KEY |
Secret cryptographic key for Django. Change this to a random string in production. | production_secret_key_change_me |
ALLOWED_HOSTS |
Comma-separated list of valid hostnames/IPs that can serve the app. | localhost,127.0.0.1 |
CSRF_TRUSTED_ORIGINS |
Comma-separated list of trusted origins for CSRF verification (include scheme, e.g., https://example.com). | http://localhost:8000 |
HOST |
The IP address the application binds to inside the container. | 0.0.0.0 |
PORT |
The port the application binds to inside the container and exposes. | 8000 |
Data is persisted using Docker named volumes. You can destroy and recreate containers without losing data.
data: Maps to/app/datainside the container. Stores the SQLite database (db.sqlite3) whenPROD=True.static_volume: Maps to/app/staticfiles. Stores collected static files (CSS, JS) for efficient serving (configured for Nginx/Web Server if needed).
To run locally without Docker for development:
- Create a virtual environment:
python -m venv venv - Activate:
venv\Scripts\activate(Windows) orsource venv/bin/activate(Linux/Mac) - Install deps:
pip install -r requirements.txt - Run migrations:
python manage.py migrate - Run server:
python manage.py runserver