Code Monkey home page Code Monkey logo

library-api's Introduction

Library Service

Online management system for book borrowings.

Features

  • JWT authenticated.
  • Admin panel /admin/
  • Documentation at /api/doc/swagger/
  • Books inventory management.
  • Books borrowing management.
  • Notifications service through Telegram API (bot and chat).
  • Scheduled notifications with Django Q and Redis.
  • Payments handle with Stripe API.

Getting access

  • create user via /api/users/
  • get access token via /api/users/token/

How to run with Docker

Docker should be installed.

Create .env file with your variables (look at .env.sample file, don't change POSTGRES_DB and POSTGRES_HOST).

docker-compose build
docker-compose up

How to run locally (without docker)

Install PostgreSQL and create database.

  1. Clone project and create virtual environment
git clone [email protected]:phaishuk/Library-API.git
cd LibraryAPI
python -m venv venv
source venv/bin/activate # on MacOS
venv\Scripts\activate # on Windows
pip install -r requirements.txt
  1. Set environment variables

Check out .env.sample file -> put all necessary variables -> rename .env.sample to .env

  1. Make migrations and run server
python manage.py migrate
python manage.py runserver
  1. Getting daily scheduled notifications in Telegram
  • in settings.py in Q_CLUSTER configuration change redis host from redis to 127.0.0.1
  • start Redis server
  • run python manage.py qcluster
  • run in separate terminal python manage.py shell to open interactive console
  • to activate scheduled task write in the opened console from borrowing import tasks
  • the task will be first processed in a minute after activating and will be scheduled for the same time the next day

A telegram bot has already been created for this application - https://t.me/libraryapi_bot

  1. Write any message in bot
  2. To retrieve chat_id use script teleram-script.py.
  3. Add to env variables chat_id retrieved by script, to test functionality.

library-api's People

Stargazers

Haishuk Pavlo avatar

Watchers

Haishuk Pavlo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.