This is the simple social network where users can create, view, like and dislike posts
- User(standard django model)
- Post(text, author, publication date, views, likes)
- Create account
- Edit account
- Delete account
- Log in
- Create post
- Edit post
- Delete post
- View post
- Like post
- Dislike post(remove like)
To know how to send these request open API_docs.md
file
- Django
- Django Rest Framework
- Django's build in DB sqlite3
- Download all requirements with
pip install -r requirements.txt
- Perform migrations to DB with
python manage.py runserver migrate
(In Backend folder)
- Run command
python manage.py runserver
in Backend folder
- Run command
python manage.py test
in Backend folder
This is bot which, with the help of API requests, perform several manipulations with users and posts
- Read
number_of_users
,max_posts_per_user
andmax_likes_per_user
frombot_configs
- Create
number_of_users
users - Log in every user
- Create from 1 to
max_posts_per_user
posts for every user - Like posts according to the next principles:
- The next user who likes a post is the user with the most posts created by him
and this user does not reach the maximum number of likes (
max_likes_per_user
). - The user likes posts until he gets the maximum number of likes.
- The user likes random posts of users who have at least one post without likes.
- If there are no posts with 0 likes at all, the bot ends its work
- Users cannot like their own posts
- Posts can be liked multiple times, but the user can like a particular post only once
- The next user who likes a post is the user with the most posts created by him
and this user does not reach the maximum number of likes (
- Delete all created users
- Run Django(you can specify not localhost in .env file + you need to add it to ALLOWED_HOSTS in settings.py )
- Just run bot.py file with
python3 bot.py
in bot directory
Every action is logged to console and bot.log
file
- Django, DRF
- requests module to send API requests
- Run
docker-compose build
in project directory
- Run
docker-compose up backend
in project directory to run backend - In another terminal run
docker-compose up bot
in project directory to run bot
- Run
docker-compose up test
in project directory