Test task for the position of Python backend developer, to implement a user API on Django REST Framework. During the test task, the following RESTful API endpoints were developed: user registration, login, getting a user profile, updating a user profile, and deleting an account using Django Rest Framework (DRF). Implemented password storage in encrypted form using the Django Argon encryption algorithm. Authorization was developed on the basis of sending OTP codes with a limited validity period to the user's email using Celery.
To deploy the project, usedocker-compose.yml
. Make sure you have Docker installed and Docker Compose.
Clone the project from Github:
git clone git@github.com:Mist3s/user_restfull_api.git
Create a ".env" file in the project root, filling example:
POSTGRES_USER=django_user
POSTGRES_PASSWORD=mysecretpassword
POSTGRES_DB=django
DB_HOST=db_host
DB_PORT=5432
SECRET_KEY='django-insecure-b9)zjp+%-wty5656gfdh5pw4qr(-452xrn_xrlinz^!+@=dk&96'
DEBUG=False
PGADMIN_DEFAULT_EMAIL=admin@email.com
PGADMIN_DEFAULT_PASSWORD=adminpassword
RABBITMQ_DEFAULT_USER=rabbitmq
RABBITMQ_DEFAULT_PASS=rabbitmq
Run Docker Compose with this configuration on your machine
docker compose up -d
Run the migrations, collect the backend static files and copy them to /static/static/:
sudo docker compose exec backend python manage.py makemigrations
sudo docker compose exec backend python manage.py migrate
sudo docker compose exec backend python manage.py collectstatic
sudo docker compose exec backend cp -r /app/static/. /static/static/
API documentation is available at: user-restfull-api.mist3s.site/api/v1/docs/ or locally 127.0.0.1:8000/api/v1/docs/
Installation on Ubuntu
-
sudo apt-get update
-
sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common
-
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
-
echo "deb [signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
-
sudo apt-get update
-
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
-
sudo usermod -aG docker $USER
-
sudo reboot
Installation on Windows
- Download the Docker Desktop installer from the official Docker website and install it.
- Launch Docker Desktop after installation.
Installation on macOS
- Download the Docker Desktop installer from the official Docker website and install it.
- Launch Docker Desktop after installation.
Python developer