This project was developed to participate in Olist's recruitment. See more here.
- 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
- This API is available in Heroku: https://olist-library.herokuapp.com/admin - you must request a login.
- Authors: https://olist-library.herokuapp.com/v1/authors/
- Books: https://olist-library.herokuapp.com/v1/books/
- 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
- Run the migrations
py manage.py migrate
- Run the custom command
py manage.py import_authors authors.csv
- NOTE: you can import your own authors using a .csv file
- 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'...
- Run the command:
py manage.py createsuperuser
- Answer the questions and memorize your user/password.
- Run the command:
py manage.py runserver
- In your Browser access this link: http://127.0.0.1:8000/admin
- Should appear a login page, log in.
- The API's local endpoints are:
- For Authors: http://127.0.0.1:8000/v1/authors/
- For Books: http://127.0.0.1:8000/v1/books/
- NOTE: All methods implemented (GET, POST, PUT and DELETE):
- 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.