- A simple Django Rest API project with a simple front-end, drf backend, Swagger UI & ReDoc documentation and Docker support.
- Python 3.8.10 (
pip install
can be sensitive to specific version) - Library/requirements.txt (
pip install -r requirements.txt
) - Currently only tested on Ubuntu 20.04 and Windows 10.
cd Library
pip install virtualenv
virtualenv venv -p <path to python3.8.10 exe>
venv\Scripts\activate
pip install virtualenv
virtualenv venv
source venv/bin/activate
pip install -r requirements.txt
python manage.py migrate
python manage.py runserver
- Firstly install Docker. (such as running
sudo apt install docker-compose
etc on a Debian based system to install the 'compose' tool.) docker-compose build
docker-compose up
- http://localhost:8000/ to see all the books listed. Then any of the books can be clicked on to see its details. This url is also the root page. To list a book, firstly, books have to be created using the API pages.
- http://localhost:8000/api/schema/ to download the schema in yaml format.
- http://localhost:8000/api/schema/swagger-ui/ to see a Swagger-UI formatted documentation.
- http://localhost:8000/api/schema/redoc/ to see a ReDoc formatted documentation.
- http://localhost:8000/api/books to see Django Rest Framework's autogenerated documentation.
Note that, in the API documentation pages, documentations for GET, POST, PATCH, PUT and DELETE requests for the BookInventory can be seen. Moreover, in Swagger UI for example, making a query is quite easy with example formats.
- To filter the author names including 'tol' and book titles with 'peace' for example, we can add our query appending a '?' to the root page and doing our queries like:
- Django
- Rest API
- Model View Template
- MVT
- drf
- drf-spectacular
- Swagger-UI
- ReDoc
- Docker