Skip to content

A powerful personal finance management web application built using Django. Key features include user authentication, expense/income tracking, category management, monthly summaries, and insightful financial reports.

Notifications You must be signed in to change notification settings

widushan/FinanceManager---Django

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

88 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Finance Manager - Django

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.

πŸš€ Features

Core Features

  • 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

AI/ML Features

  • Expense Prediction - ML-powered expense forecasting
  • Anomaly Detection - Identify unusual spending patterns
  • Financial Insights - AI-generated recommendations
  • Trend Analysis - Historical data analysis and trends

API Features

  • RESTful API - Complete API for mobile/web integration
  • Swagger Documentation - Interactive API documentation
  • CORS Support - Cross-origin resource sharing enabled

πŸ› οΈ Technology Stack

  • 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

πŸ“‹ Prerequisites

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)

πŸš€ Installation & Setup

1. Clone the Repository

git clone https://github.com/widushan/FinanceManager---Django.git
cd FinanceManager---Django

2. Create Virtual Environment

# Windows
python -m venv venv
venv\Scripts\activate

# macOS/Linux
python3 -m venv venv
source venv/bin/activate

3. Install Dependencies

pip install -r requirements.txt

4. Database Setup

Option A: SQLite (Development - Default)

The application is configured to use SQLite by default for development. No additional setup required.

Option B: PostgreSQL (Production)

  1. Install PostgreSQL
  2. Create a database named finance
  3. 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'
    }
}

5. Run Migrations

cd ExpenseTracker
python manage.py makemigrations
python manage.py migrate

6. Create Superuser (Optional)

python manage.py createsuperuser

7. Run the Development Server

python manage.py runserver

The application will be available at http://127.0.0.1:8000/

πŸ“± Usage

Web Interface

  1. Home Page: http://127.0.0.1:8000/
  2. Register: http://127.0.0.1:8000/accounts/register/
  3. Login: http://127.0.0.1:8000/accounts/login/
  4. Expenses: http://127.0.0.1:8000/expenses
  5. Incomes: http://127.0.0.1:8000/incomes
  6. Reports: http://127.0.0.1:8000/report/
  7. AI Insights: http://127.0.0.1:8000/ai-insights/

Image Image Image Image Image Image Image Image

API Endpoints

  • 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/

Admin Interface

  • Django Admin: http://127.0.0.1:8000/admin/

πŸ”§ Configuration

Environment Variables

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/finance

Static Files

For production, collect static files:

python manage.py collectstatic

πŸ§ͺ Testing

Run the test suite:

python manage.py test

🧾 Test Reports

Generate and submit test coverage, performance testing results, and security audit findings:

python run_tests.py

This command runs the full suite and produces report files in the project root:

  • TEST_COVERAGE_REPORT.md β€” Coverage summary
  • PERFORMANCE_TEST_REPORT.md β€” Page/API performance results
  • SECURITY_AUDIT_REPORT.md β€” Security checks overview
  • test_report.json β€” Comprehensive machine-readable summary

You can find raw coverage data in ExpenseTracker/coverage.json as well.

πŸ“Š Project Structure

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

πŸ€– AI/ML Features

Expense Prediction

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/

Anomaly Detection

Identifies unusual spending patterns:

GET /api/anomalies/

Financial Insights

AI-generated recommendations for better financial management.

πŸ”Œ API Documentation

Authentication

The API supports token-based authentication and session authentication.

Endpoints

  • GET /api/v1/accounts/ - List user accounts
  • POST /api/v1/accounts/ - Create new account
  • GET /api/v1/expenses/ - List expenses
  • POST /api/v1/expenses/ - Create new expense
  • GET /api/v1/incomes/ - List incomes
  • POST /api/v1/incomes/ - Create new income
  • GET /api/v1/reports/financial/ - Get financial reports
  • GET /api/v1/ai/insights/ - Get AI insights

For complete API documentation, visit: http://127.0.0.1:8000/swagger/

πŸ› Troubleshooting

Common Issues

  1. Database Connection Error

    • Ensure PostgreSQL is running
    • Check database credentials in settings.py
    • Verify database exists
  2. Static Files Not Loading

    • Run python manage.py collectstatic
    • Check STATIC_URL and STATIC_ROOT settings
  3. ML Features Not Working

    • Install required packages: pip install scikit-learn pandas joblib
    • Ensure you have sufficient data for training
  4. Migration Errors

    • Delete migration files and recreate: python manage.py makemigrations --empty app_name
    • Reset database if needed

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature-name
  3. Commit your changes: git commit -am 'Add feature'
  4. Push to the branch: git push origin feature-name
  5. Submit a pull request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ‘₯ Support

For support and questions:

πŸ”„ Version History

  • 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

About

A powerful personal finance management web application built using Django. Key features include user authentication, expense/income tracking, category management, monthly summaries, and insightful financial reports.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published