Code Monkey home page Code Monkey logo

imdb-app-api's Introduction

Pre-setup

After downloading go to the root directory of the project:

cd imdb-app-api

Create a virtual environment:

python -m venv venv

Install requirements:

pip install -r requirements.txt

Build Docker containers

Build an app and database containers:

docker-compose build

Fill a database

Fill the database with the data from .csv files:

python manage.py fill_db queries/fill_db.sql

Path queries/fill_db.sql is an argument that determines the way to the .sql file to fill the database.

Usage

Run the docker containers:

docker-compose up

Movie

List of all movies:

http://127.0.0.1:8000/api/movie/movies/

You can specify the page and number of elements per page in the url. Example:

http://127.0.0.1:8000/api/movie/movies/?page=2&size=5

This url will send you on the second page and make max elements per page as five.

Old filtering

Movies by director:

In the url path specify a director name. You must specify it using d as a key d=director_name. Example:

http://127.0.0.1:8000/api/movie/movies/d=Ahmed/

Movies by genre:

Same as a director name specify the genre using g as a key g=genre_name. Example:

http://127.0.0.1:8000/api/movie/movies/g=Comedy

Filtering through query_params

Movies by director:

In the url path specify a director name after ?. You must specify it using director as a key director=director_name. Example:

http://127.0.0.1:8000/api/movie/movies/?director=Ahmed

Movies by genre:

Specify the genre after ? using genre as a key genre=genre_name. Example:

http://127.0.0.1:8000/api/movie/movies/?genre=Comedy

Actor

Actor information:

General url:

http://127.0.0.1:8000/api/actor/actor_stats/actor_id/

Specify the actor id in the url to see information about actor. Example:

http://127.0.0.1:8000/api/actor/actor_stats/15000/

Via this url you can see information about actor with id=15000

Tests

Run all tests:

docker-compose run --rm app sh -c "python manage.py test"

Additional information

Data folder

All the data which are .csv files for the database are stored in the data folder in the root directory.

SQL queries

SQL scripts to create tables and fill them with the data from .csv files are stored in the queries folder in the root directory.

imdb-app-api's People

Contributors

iprogrammerdmytro avatar

Watchers

Stephan Mazokha avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.