an app for splitting bills amongst other people
pip install -r requirement.txt
First, create a .env
file in the root directory (same level as the manage.py
)
Access the Python interactive shell by running the following in the terminal
(env) $ python manage.py shell
In the shell, import the get_random_secret_key()
function from django.core.management.utils
>>> from django.core.management.utils import get_random_secret_key
Use the function to generate the secret key
>>> get_random_secret_key()
somerandomkeygenerated
Copy this secret key and set it as SECRET_KEY
value in the .env
file
SECRET_KEY='somerandomkeygenerated'
Now you can run the development server by running the following
(env) $ python manage.py runserver
Optionally you can provide a specific port
(env) $ python manage.py runserver 8000
Access the app by going to the /gbill
page of the server. (e.g. http://localhost:8000/gbill)
This is an app designed to split bills amongst other people by using the minimal number of transactions.
Brief Explanation
When we have multiple people who paid for multiple different transactions, it gets difficult to calculate who owes how much to whom. Simple way to calculate is to sum up everything person A owes to person B. But this creates multiple extraneous transaction. For example, after summing up the debt we have:Method 1
A
pays 10 toB
B
pays 40 toC
C
pays 20 toA
flowchart LR
n1([A]) --> |pays 10| n2([B])
n2([B]) --> |pays 40| n3([C])
n3([C]) --> |pays 20| n1([A])
This required 3 transactions to settle the debts. Now instead, we can have B
pays for A
by not accepting the payment from A
:
Method 2
B
pays 10 toA
B
pays 20 toC
flowchart LR
n2([B]) --> |pays 10| n1([A])
n2([B]) --> |pays 20| n3([C])
This new method required 2 transactions to settle the debts. And to double check, we can check how much money each person have in the end for each method:
Method 1 | Method 2 |
---|---|
A has (-10) + (20) = 10 |
A has 10 |
B has 10 + (-40) = -30 |
B has (-10) + (-20) = -30 |
C has 40 + (-20) = 20 |
C has 20 |
And thus, we conclude there is no discrepancy for method 2 despite at a glance it looks wrong.
- CLI Feature
- Convert tkinter gui to django
- Export result as PDF, PNG, and TXT
- Implement more graphs to show accounting data
- Implement users & saving/loading & sharing bill info
Trashed ideas
- Implement Docker
- Convert to Flask (instead of Django)