Skip to content

Commit

Permalink
Merge pull request #35 from Naz-iv/readme
Browse files Browse the repository at this point in the history
Readme
  • Loading branch information
Naz-iv authored Dec 18, 2023
2 parents 6132193 + 18acd11 commit 50a2199
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 3 deletions.
1 change: 0 additions & 1 deletion .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ POSTGRES_USER=POSTGRES_USER
POSTGRES_PASSWORD=POSTGRES_PASSWORD
RABBIT_URL=RABBIT_URL
TELEGRAM_BOT_TOKEN=TELEGRAM_BOT_TOKEN
CHAT_ID=CHAT_ID
CHAT_URL=CHAT_URL
DOMAIN=http://localhost:8080
69 changes: 68 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,68 @@
# library-service
# library-service

This app was created for managing library data, with information on books, borrowings and payments regarding them.

# .env

Before running the project either in Docker or locally, you need to create .env file in the project`s root directory.
You can fill it with this data or create it from .env.sample with your own:

`
STRIPE_SECRET_KEY=STRIPE_SECRET_KEY
STRIPE_PUBLISHABLE_KEY=STRIPE_PUBLISHABLE_KEY
POSTGRES_HOST=db
POSTGRES_DB=library
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
RABBIT_URL=amqp://guest:guest@rabbitmq3:5672/
DOMAIN=http://localhost:8080
TELEGRAM_BOT_TOKEN=TELEGRAM_BOT_TOKEN
CHAT_URL=CHAT_URL
DOMAIN=http://localhost:8080
`

You can get stripe keys here: https://stripe.com/
Chat URL is for your telegram chat`s url, and you can get Telegram Bot Token here: https://t.me/BotFather

# Lauching project locally

To launch the application, follow next steps:

1. Fork the repository

2. Clone it:
`git clone <here goes the HTTPS link you could copy on github repositiry page>`

3. Create a new branch:
`git checkout -b <new branch name>`

4. Create virtual environment:
`python3 -m venv venv`

5. Acivate venv:
`source venv/Scripts/activate`

6. Install requirements:
`pip3 install -r requirements.txt`

7. Run migrations:
`python3 manage.py migrate`

8. Load the data from fixture:
`python3 manage.py loaddata books_fixture.json`

9. Run server:
`python3 manage.py runserver`

To run the tests:
`python3 manage.py test book_service/tests`
`python3 manage.py test borrowing_service/tests`
`python3 manage.py test customer/tests`
`python3 manage.py test notifications_service/tests`
`python3 manage.py test payment_service/tests`

# Running with docker

After installing Docker run:
- docker-compose build
- docker-compose up
2 changes: 1 addition & 1 deletion borrowing_service/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def check_overdue_task(self):
for user in get_user_model().objects.all():
if user not in users:
send_notification(
TelegramUser.objects.get(user_id=borrowing.user.pk).chat_id,
TelegramUser.objects.get(user_id=user.pk).chat_id,
"No borrowings overdue today!"
)
return "Done sending notifications!"

0 comments on commit 50a2199

Please sign in to comment.