The application provides API for dealing with reference books.
Endpoints:
Endpoint | Method | Description |
---|---|---|
/refbooks/ [?date=] | GET | Returns all available refbooks. If a date parameter is provided, only refbooks, which have versions with started date after the requested date, will be returned. |
/refbooks/{id}/elements [?version={version}] | GET | Returns elements of the requested refbook in the latest version. If a version parameter provided, only elements of this version of the RefBook will be returned. |
/refbooks/{id}/check_element?code={code}&value={value} [&version={version}] | GET | Checks if the element with provided parameters exists. If a version parameter is absent, the element will be checked in the latest version. |
/docs | GET | API documentation with Swagger/OpenAPI 2.0 specifications. |
/admin | GET | Admin interface. |
This project was built using these tools:
Tool | Description |
---|---|
Django | "A high-level Python web framework" |
Django REST framework | "A powerful and flexible toolkit for building Web APIs" |
drf-yasg | "Generate real Swagger/OpenAPI 2.0 specifications from a Django Rest Framework API." |
poetry | "Python dependency management and packaging made easy" |
Copy a project
$ git clone [email protected]:Dddarknight/refbooks.git
$ cd refbooks
Set up environment variables
$ touch .env
You have to write into .env file SECRET_KEY for Django app. See .env.example.
To get SECRET_KEY for Django app:
$ python manage.py shell
>>> from django.core.management.utils import get_random_secret_key
>>> get_random_secret_key()
Then add new SECRET_KEY to .env file
Set up the environment
$ pip install poetry
$ make install
Dealing with migrations
$ make migrate
Launch
$ make run