Tajl is an app for sharing expenses inspired by Splid. You can host this yourself. This here is the backend.
Workd for me with Python 3.10 and 3.12. Django is probably the most restricive package concerning the python version.
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
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",
]
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.
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.