Olist Library - Work at Olist

This project was developed to participate in Olist's recruitment. See more here.

Requirements

  • Python 3.8.1
  • Windows 10 (this project was developed in W10, so the command lines are from CMD, but is easy to "translate" to Linux)
  • A virtual enviroment

Heroku

Endpoints:

Steps:

1 - Install the requirements.txt

  • Download or clone the project into your preferred folder.
  • In a CMD, browse to your folder.
  • Create/Activate the virtual enviroment. How To.
  • Install the "requirements.txt"
py -m pip install -r requirements.txt

2 - Django Migrate

  • Run the migrations
py manage.py migrate

3 - Import Authors

  • Run the custom command
py manage.py import_authors authors.csv
  • NOTE: you can import your own authors using a .csv file

4 - Run tests

  • Run the tests:
py manage.py test
  • Check if the tests passed, must return this message (or similar):
Creating test database for alias 'default'...
System check identified no issues (0 silenced).
..........................
----------------------------------------------------------------------
Ran 26 tests in 15.270s

OK
Destroying test database for alias 'default'...

5 - Create a superuser

  • Run the command:
py manage.py createsuperuser
  • Answer the questions and memorize your user/password.

6 - Run server and login

  • Run the command:
py manage.py runserver

7 - Access and use the API

8 - TODO

  • Alter the ManyToMany relation beetwen Authors and Books to a ForeignKey - like this. Because Django allows delete an Author when it is related to a Book.
  • Develop more tests with invalids requests.