A simple implementation of Django and Django Rest Framework.
Example: django-movie-api.herokuapp.com
Available endpoints:
- /movies GET - List movies added to the database
- allow ordering for id, title, released, runtime, writer and director fields
- /movies POST - Add movie to database, data from omdbapi.com, validation based on the movie title
- required movie title in the request body
- /comments GET - List all comments added to movies in db
- allow ordering for all fields
- allow filtering based on a commented movie
- /comments POST - Add comment to movies in db, request body params:
- movie and text are required
- posting author is optional
- add_date is default today
- /top GET - List most commented movies in the given date range,
specifying date range is required,
query params:
- start-date=DD-MM-YYY
- end-date=DD-MM-YYY
Requirements:
- latest verison of docker
- latest version of docker compose
Uses default SQLite database and Django development server.
Run app by docker compose locally(on Linux):
- Open terminal
- Copy git repository
- Go to the project directory:
$ cd django_movies_api - Build images:
$ docker-compose build
- Run containers:
$ docker-compose up -d
- Create a database:
$ docker-compose exec web python manage.py migrate --noinput - The server should be running on: localhost:8000
Uses Heroku, PostgreSQL and gunicorn. For deployment use heroku.yml.