A powerful personal finance management web application built using Django with AI/ML capabilities. This comprehensive application helps users track their income, expenses, and budgets efficiently with intelligent insights and predictions.
- User Authentication & Registration - Secure user management system
- Expense Tracking - Add, edit, delete, and categorize expenses
- Income Management - Track various income sources
- Financial Reports - Interactive charts and monthly summaries
- Account Management - Multiple account support with balance tracking
- Long-term Financial Planning - Support for loans, investments with interest calculations
- Expense Prediction - ML-powered expense forecasting
- Anomaly Detection - Identify unusual spending patterns
- Financial Insights - AI-generated recommendations
- Trend Analysis - Historical data analysis and trends
- RESTful API - Complete API for mobile/web integration
- Swagger Documentation - Interactive API documentation
- CORS Support - Cross-origin resource sharing enabled
- Backend: Django 5.2.1
- Database: PostgreSQL (with SQLite for development)
- Frontend: HTML, CSS, JavaScript
- Charts: Plotly.js
- AI/ML: Scikit-learn, Pandas, NumPy
- API: Django REST Framework
- Documentation: Swagger/OpenAPI
- Deployment: Gunicorn, WhiteNoise
Before running this application, make sure you have the following installed:
- Python 3.8 or higher
- PostgreSQL (for production) or SQLite (for development)
- pip (Python package installer)
git clone https://github.com/widushan/FinanceManager---Django.git
cd FinanceManager---Django# Windows
python -m venv venv
venv\Scripts\activate
# macOS/Linux
python3 -m venv venv
source venv/bin/activatepip install -r requirements.txtThe application is configured to use SQLite by default for development. No additional setup required.
- Install PostgreSQL
- Create a database named
finance - Update database settings in
ExpenseTracker/ExpenseTracker/settings.py:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'finance',
'USER': 'postgres',
'PASSWORD': 'your_password',
'HOST': 'localhost',
'PORT': '5432'
}
}cd ExpenseTracker
python manage.py makemigrations
python manage.py migratepython manage.py createsuperuserpython manage.py runserverThe application will be available at http://127.0.0.1:8000/
- Home Page:
http://127.0.0.1:8000/ - Register:
http://127.0.0.1:8000/accounts/register/ - Login:
http://127.0.0.1:8000/accounts/login/ - Expenses:
http://127.0.0.1:8000/expenses - Incomes:
http://127.0.0.1:8000/incomes - Reports:
http://127.0.0.1:8000/report/ - AI Insights:
http://127.0.0.1:8000/ai-insights/
- API Root:
http://127.0.0.1:8000/api/v1/ - Swagger Documentation:
http://127.0.0.1:8000/swagger/ - ReDoc Documentation:
http://127.0.0.1:8000/redoc/
- Django Admin:
http://127.0.0.1:8000/admin/
Create a .env file in the project root for sensitive configuration:
SECRET_KEY=your-secret-key-here
DEBUG=True
DATABASE_URL=postgresql://user:password@localhost:5432/financeFor production, collect static files:
python manage.py collectstaticRun the test suite:
python manage.py testGenerate and submit test coverage, performance testing results, and security audit findings:
python run_tests.pyThis command runs the full suite and produces report files in the project root:
TEST_COVERAGE_REPORT.mdβ Coverage summaryPERFORMANCE_TEST_REPORT.mdβ Page/API performance resultsSECURITY_AUDIT_REPORT.mdβ Security checks overviewtest_report.jsonβ Comprehensive machine-readable summary
You can find raw coverage data in ExpenseTracker/coverage.json as well.
FinanceManager---Django/
βββ ExpenseTracker/
β βββ exp_tracker/ # Main Django app
β β βββ models.py # Database models
β β βββ views.py # View logic
β β βββ urls.py # URL routing
β β βββ api_views.py # API views
β β βββ serializers.py # API serializers
β β βββ ml_models.py # AI/ML functionality
β β βββ templates/ # HTML templates
β β βββ static/ # CSS, JS, images
β βββ ExpenseTracker/ # Django project settings
β β βββ settings.py # Project configuration
β β βββ urls.py # Main URL configuration
β βββ manage.py # Django management script
βββ requirements.txt # Python dependencies
βββ README.md # This file
βββ Procfile # Heroku deployment
The application uses machine learning to predict future expenses based on historical data:
# Train the model
POST /api/train-model/
# Get predictions
GET /api/predict-expenses/Identifies unusual spending patterns:
GET /api/anomalies/AI-generated recommendations for better financial management.
The API supports token-based authentication and session authentication.
GET /api/v1/accounts/- List user accountsPOST /api/v1/accounts/- Create new accountGET /api/v1/expenses/- List expensesPOST /api/v1/expenses/- Create new expenseGET /api/v1/incomes/- List incomesPOST /api/v1/incomes/- Create new incomeGET /api/v1/reports/financial/- Get financial reportsGET /api/v1/ai/insights/- Get AI insights
For complete API documentation, visit: http://127.0.0.1:8000/swagger/
-
Database Connection Error
- Ensure PostgreSQL is running
- Check database credentials in settings.py
- Verify database exists
-
Static Files Not Loading
- Run
python manage.py collectstatic - Check STATIC_URL and STATIC_ROOT settings
- Run
-
ML Features Not Working
- Install required packages:
pip install scikit-learn pandas joblib - Ensure you have sufficient data for training
- Install required packages:
-
Migration Errors
- Delete migration files and recreate:
python manage.py makemigrations --empty app_name - Reset database if needed
- Delete migration files and recreate:
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Commit your changes:
git commit -am 'Add feature' - Push to the branch:
git push origin feature-name - Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
For support and questions:
- Create an issue in the repository
- Contact: pasindukavishka2001@gmail.com
- v1.0.0 - Initial release with basic expense tracking
- v1.1.0 - Added AI/ML features and API
- v1.2.0 - Enhanced reporting and user interface
Note: This application is designed for personal use and educational purposes. For production deployment, ensure proper security measures and data protection compliance.
created by: Pasindu Kavishka 22ug1-0729







