613c99dce2
also provided tests
1.8 KiB
1.8 KiB
Lotty Backend
Prerequisites
Ensure you have the following installed on your system:
- Python (>=3.13,<3.15)
- uv (latest version recommended)
- Docker (for containerized setup, latest version recommended)
Basic setup
Installation
Clone the project
Go to the project directory
Customize environment
cp .env.template .env
And setup env vars according to your needs.
Install dependencies
For dev environment
uv sync --all-extras
For prod environment
uv sync --no-dev
Running
Apply migrations
uv run python manage.py migrate
Start celery worker
celery -A config worker -l INFO
Start server
In dev mode:
uv run python manage.py runserver
In prod mode:
uv run gunicorn config.wsgi
Containerized setup
Clone the project
Go to the project directory
Build docker image
docker build -t lotty-backend .
Customize environment
Customize environment with docker run command (or bind .env file to container), for all environment vars and default values see .env.template.
Run docker image
Backend
docker run -p 8080:8080 --name lotty-backend lotty-backend
Celery worker
docker run --name lotty-celery-worker lotty-backend celery -A config worker -l INFO
Backend will be available on 127.0.0.1:8080.
Testing
Clone the project
Go to the project directory
Install dependencies
uv sync --all-extras
Run tests (with coverage)
just test-coverage
Check coverage
just show-coverage