Skip to content
Nyaguthii-CPublic

About

Expenses tracking application - Python/Django Backend - Django Rest Framework

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

51 Commits

Folders and files

Repository files navigation

Soldi

An expenses tracking application built in python/Django, Django Rest Framework and postgreSQL database. Supports user registration, authentication, logging and categorization of expenses and budget.


Features

  • User Profile
  • Budget
  • Expense (logging)
  • Expense Categories

Models

User (authentication)
UserProfile (monthly budget and user-specific settings)
ExpenseCategory (shared list of categories)
Expense (the actual spending records) Budget (monthly budget amount and currency)

Tech Stack

  • Backend: Django, Django REST Framework
  • Database: PostgreSQL
  • Docs: Swagger / drf-yasg
  • Testing: Pytest, pytest-django
  • DevOps: Docker, Docker Compose
  • Frontend: JavaScript, Css, HTML, Vite, React

Setup Instructions

1. Clone the Repo

git clone https://github.com/Nyaguthii-C/Soldi.git
cd Soldi

2. Create Virtual Environment

python -m venv venv
source venv/bin/activate

3. Install Dependencies

pip install -r requirements.txt

4. Setup Environmental Variables .env

SECRET_KEY=valuehere
POSTGRES_DB=valuehere
POSTGRES_USER=valuehere
POSTGRES_PASSWORD=valuehere
DEBUG=TrueOrFalse
DATABASE_URL=valuehere
ALLOWED_HOSTS=valuehere

5. Configure Database

Set up PostgreSQL and update .env (see .env.example).
Create a PostgreSQL database and user (if not already created).

Log in to PostgreSQL:

Open your terminal and log in to the PostgreSQL command line interface:

psql -U postgres

(Replace postgres with your username if you use a different PostgreSQL username.)

Create a Database:

To create a new database, run:

CREATE DATABASE your_db_name;

Create a User:

Create a user (if it doesn’t exist) with a password:

CREATE USER your_db_user WITH PASSWORD 'your_db_password';

Grant Privileges:

Grant all privileges on the database to the user:

GRANT ALL PRIVILEGES ON DATABASE your_db_name TO your_db_user;

Exit PostgreSQL:

\q
``` -->

### 6. Run Migrations
```bash
python manage.py makemigrations
python manage.py migrate

7. Collect static files

python manage.py collectstatic

7. Run Server (supporting wsgi)

gunicorn config.wsgi:application

Running Tests

pytest

API Documentation

Access Swagger UI at:

http://localhost:8000/swagger/

Docker Setup (Optional)

  1. Installing Docker and Docker Compose
sudo apt update && sudo apt install docker.io docker-compose -y
sudo systemctl enable docker -->
  1. Build and Run the Containers
sudo docker-compose up --build
  1. Access App
API: http://localhost:8000

Swagger Docs: http://localhost:8000/swagger/
  1. Common Docker Commands

Stop all services

docker-compose down

View logs from web app

docker-compose logs -f web

Bash into the web container

docker-compose exec web bash

Views

Views
│
├── register()
├── get_profile()
├── update_profile()
├── log_expense()
│        │
│        └── create_expenses()
│                 │
│                 └── create_expense()
│
├── list_expenses()
├── update_expense()
├── delete_expense()
│
├── month_total()
│        │
│        └── get_month_total()
│
├── category_summary()
│        │
│        └── get_category_summary()
│
└── monthly_summary()
         │
         ├── get_month_total()
         └── get_category_summary()

Tests

To run tests on the project:

python manage.py test soldi_app.tests

Author

Nyaguthii Carol

About

Expenses tracking application - Python/Django Backend - Django Rest Framework

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages