https://github.com/znitche/sleepwalker-backend
django restframework backend for sleepwalker wearos app
https://github.com/znitche/sleepwalker-backend
api django django-rest-framework sleep-analysis sleep-tracker
Last synced: 8 months ago
JSON representation
django restframework backend for sleepwalker wearos app
- Host: GitHub
- URL: https://github.com/znitche/sleepwalker-backend
- Owner: zNitche
- Archived: true
- Created: 2023-08-30T16:14:13.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-13T18:33:41.000Z (over 2 years ago)
- Last Synced: 2025-03-24T06:51:55.539Z (12 months ago)
- Topics: api, django, django-rest-framework, sleep-analysis, sleep-tracker
- Language: Python
- Homepage:
- Size: 193 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Sleepwalker - Backend
Part of [sleepwalker](https://github.com/zNitche/sleepwalker) project.
Django powered backend for sleep monitoring and sleepwalking detection + prevention system.
---
### Technologies
- Django 4.2
- django rest framework 3.14
- gunicorn
- celery
- swagger (drf-spectacular)
### Features
- Token and ApiKey based authentication.
- Heart beat monitoring and sleepwalking detection.
- Configurable detection parameters (user settings).
### Setup
#### Dev
1. Create `.env` file
```
cp .env.template .env
```
2. Run dev docker services.
```
sudo docker compose -f docker-compose-dev.yml up
```
3. Run celery workers
```
sh scripts/celery_entrypoint.sh
```
#### Prod
1. Create `.env` file
```
cp .env.template .env
```
2. Change config values
- `DEBUG` - set to 0
- `DB_PATH` - database path
- `LOGS_PATH` - logs path
- `ALLOWED_HOSTS` - comma separated host names
- `POSTGRES_USER` - database user
- `POSTGRES_PASSWORD` - password for database
3. Run docker services.
```
sudo docker compose up -d
```
#### Accounts Management
1. Bash into web app container.
```
sudo docker container exec -it sleepwalker_backend bash
```
2. Run accounts manager cli `python3 manage.py create_user`.
#### API Documentation
swagger documentation can be found (only `DEBUG` mode)
```
/api/docs
```
#### Tests
```
python3 manage.py test
```