In order to run project locally, you need to have docker, and docker-compose installed. You can see detailed instructions how to install it here: Docker and here: Docker Compose
To run the project locally navigate to a project directory, and build docker image:
docker-compose build
and after that, start the project by running:
docker-compose up
The project should be available on 127.0.0.1:8000
To run automated tests you should have container up and running. First section explains how to achieve it. After that you can run the tests by executing:
docker exec movies_api python3 manage.py test
To develop this app I have used requests, whitenoise and django-rest-framework. I have used requests to build movie-service which handle external API requests. Whitenoise serves static files from django-rest-framework. Django-rest-framework was used to actually build API, including serializers and views. For SQLite/PostgreSQL handling python-dotenv and dj-database-url are in use.
App uses sql-lite local database, when ran locally. When deployed to heroku, it doesnt gets .env_prod file, which have DATABASE_URL env variable changed to production database uri.
Takes title of a movie as argument (in JSON file), and saves it to database.
{'title':'The Shining'}
Returns all movies in database.
Takes movie id and comment as arguments and add comment to database.
{'movie':1,'comment':'Cool!'}
Returns all coments from database.
Returns ranking of movies from specified period of time.
/top/?date_start=2011-10-21&date_end=2020-10-21