- Token authentication (Djoser)
- Easy management of your tasks
Method | URL | Headers | Body | Description |
---|---|---|---|---|
POST |
/api/v1/auth/users/ |
- |
email , username , password |
Register a new user |
POST |
/api/v1/auth/token/login/ |
- |
username , password |
Obtain the user authentication token |
GET |
/api/v1/auth/users/me/ |
Authorization: Token <user_token> |
- |
Get the user data |
POST |
/api/v1/auth/users/set_username/ |
Authorization: Token <user_token> |
new_username , current_password |
Change the username |
POST |
/api/v1/auth/users/set_password/ |
Authorization: Token <user_token> |
new_password , current_password |
Change the user password |
POST |
/api/v1/auth/token/logout/ |
Authorization: Token <user_token> |
- |
Logout the user (remove the user authentication token) |
DELETE |
/api/v1/users/me/ |
Authorization: Token <user_token> |
current_password |
Delete the user |
GET |
/api/v1/tasks/ |
Authorization: Token <user_token> |
- |
Get the user tasks |
POST |
/api/v1/tasks/ |
Authorization: Token <user_token> |
title , description (str, default=blank), priority (float [0; 1], default=1), completed (bool, default=False) |
Post a new task |
GET |
/api/v1/tasks/<task_id>/ |
Authorization: Token <user_token> |
- |
Get the task |
PATCH |
/api/v1/tasks/<task_id>/ |
Authorization: Token <user_token> |
Any key (title / description / priority / completed ) |
Update the task |
DELETE |
/api/v1/tasks/<task_id>/ |
Authorization: Token <user_token> |
- |
Delete the task |
- Docker
-
Create
.env.dev
file with variables as in the file in theexamples/docker/env/
folder, then put it in thedocker/env/
folder -
(For prod) Create
.env.prod
file with variables as in the file in theexamples/docker/env/
folder, then put it in thedocker/env/
folder -
(For prod) Create
django.conf
file with your data as in theexamples/docker/nginx/prod/
folder, then put it in thedocker/nginx/prod
folder -
(For prod) Create
docker-compose.yml
file with your data as in theexamples/
folder, then put it in the/
folder -
(For prod) Change
settings.py
:environ.Env.read_env(env_file=Path('./docker/env/.env.dev'))
--->environ.Env.read_env(env_file=Path('./docker/env/.env.prod'))
-
Run the dev build
docker compose -f docker-compose.dev.yml up --build -d
-
Run the prod build and get a SSL certificate
-
Build the project
docker compose build
-
Start Docker and get a certificate
docker compose up nginx certbot
-
Stop your containers to continue
docker compose stop
-
Comment out the command in
docker-compose.yml
command: certonly --webroot --webroot-path=/var/www/certbot/ --email <your_email> --agree-tos --no-eff-email -d <domain (example.com)> -d <domain (www.example.com)>
-
Uncomment the part of nginx config in
docker/nginx/prod/django.conf
-
Start Docker again
docker compose up -d
-
Set up automatic certificate renewal every 60 days in cron tab
echo "0 0 1 */2 * ./todo_app/renew_cert.sh" | crontab -
-
docker compose stop