Skip to content

YAWNICK/tajl-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tajl-api

What's this?

Tajl is an app for sharing expenses inspired by Splid. You can host this yourself. This here is the backend.

Setup

Workd for me with Python 3.10 and 3.12. Django is probably the most restricive package concerning the python version.

Environment

Be at the root of the cloned repo. If you're using venv:

python -m venv venv

activate/deactivate (bash): source venv/bin/activate / deactivate

install requirements:

pip install -r requirements.txt

Local settings

In /tajlAPI/tajlAPI next to settings.py create localsettings.py, which needs the following content:

# localsettings.py example

SECRET_KEY = 'your-secret-key'

ALLOWED_HOSTS = ['123.456.789.00']
STATIC_URL = 'static/'
BASE_PATH = ''

DEBUG = False

CORS_ALLOWED_ORIGINS = [
    "http://127.0.0.1:5500",
    # Add any other origins you want to allow
]

CORS_ALLOW_CREDENTIALS = True
#CSRF_COOKIE_SECURE = False


CSRF_TRUSTED_ORIGINS = [
    "http://127.0.0.1:5500",
]

Database and Django setup

Back in tajlAPI, run the following commands

python manage.py makemigrations api
python manage.py migrate
python manage.py createsuperuser
python manage.py collectstatic

collectstatic is only necessary if you have DEBUG = False.

Prod setup - gunicorn

In the conf folder, create gunicorn_config.py:

# gunicorn_config.py

command = '[your path]/tajl-api/venv/bin/gunicorn'
pythonpath = '[your path]/tajl-api/tajlAPI'
bind = '127.0.0.1:8000'
workers = 1

Run the gunicorn server:

gunicorn -c conf/gunicorn_config.py tajlAPI.wsgi

Then Strg+z to halt, then bg to move process to background.

About

Share expenses without downloading an app or making an account.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages