This project is a fork from Work at olist project by Olist. It's an application for a library to store book and authors data.
Click here to open a demo of the app on Heroku.
- Ubuntu 18.04.3
- Python 3.6.10
- Django 3.0.5
- Django Rest Framework 3.11.0
- Original instructions
- API documentation
- Site adminitration (user: olist, pass: 0L1sTt3ch)
- Project activities on Trello Kaban Board
Enhanced entity-relationship (EER) diagram:
Author endpoints, more information here.
Method | Endpoint | Description |
---|---|---|
GET |
/v1/authors/ | List all of authors |
POST |
/v1/authors/ | Creates a new author |
GET |
/v1/authors/{id}/ | Retrieves an author details |
PUT |
/v1/authors/{id}/ | Updates an author |
DELETE |
/v1/authors/{id}/ | Deletes an author |
Book endpoints, more information here.
Method | Endpoint | Description |
---|---|---|
GET |
/v1/books/ | List all of books |
POST |
/v1/books/ | Creates a new book |
GET |
/v1/books/{id}/ | Retrieves a book details |
PUT |
/v1/books/{id}/ | Updates a book |
DELETE |
/v1/books/{id}/ | Deletes a book |
Install pip, virtualenv and virtualenvwrapper packages:
sudo apt-get install python3-pip
sudo pip3 install virtualenv virtualenvwrapper
For configure the VirtualEnvWrapper, edit the file /home/user/.bashrc
:
Include the content bellow at the end of the file:
# Python Virtualenvs
export WORKON_HOME=/home/user/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3.6
source /usr/local/bin/virtualenvwrapper.sh
export PIP_REQUIRE_VIRTUALENV=true
Restart the terminal and run the command bellow to create a virtualenv:
mkvirtualenv olistlibrary
Clone this repository and access to the folder:
git clone https://github.com/rafaelassacconi/work-at-olist.git
Activate the virtualenv:
workon olistlibrary
Install the packages required:
pip install -r requirements.txt
Run migrate command to create a database:
olistlibrary/manage.py migrate
Run the command bellow to import authors and books data:
olistlibrary/manage.py import_authors files/authors.csv
olistlibrary/manage.py import_books files/books.csv
Use the command bellow to execute the application:
olistlibrary/manage.py runserver
Access the application using this link: http://localhost:8000
If you want run the tests, use this command bellow:
olistlibrary/manage.py test books