An open API service indexing awesome lists of open source software.

https://github.com/artur24814/kinomania2_rest_api

Rest api application for manage work in the cinema 🎦
https://github.com/artur24814/kinomania2_rest_api

django-rest-framework rest-api

Last synced: over 1 year ago
JSON representation

Rest api application for manage work in the cinema 🎦

Awesome Lists containing this project

README

          

# Kinomania2_REST_api






    Contents



  • Info

    Information about the resources used in this project


  • KNOMANIA REST API

    Website for looking translation of words and create your self vocabulary and train your knowledge in a card game


  • Clone and Run a Django Project

    how run projects in your computer



INFO


Information about the additional library, external Api used in this project and general information




  • wikipedia Api

    Used when user add movie and
    when he didn't writen description, application found itself appropriate description using wikipedia Api, if title will be wrong and application couldn't did this, in label 'description' will be put information from label 'tiltle'




  • GeoIP2


    Used when user add cinema and didn't writen 'city', in this case application check your public ip (you can check your public ip yourself in website https://www.whatismyip.com/) and with using api GeoIP2 found city where user is, and put name of city in label 'city'




  • django-crontab

    using for delete screening when screening is out-of date.
    Every 5 seconds crontab check screening datetime, and when actual date and time is more than date and time in screening it will be delete


    don't forget write this command
    python manage.py crontab add




  • Views

    I write it with using API views, it's my own personal choice because I think in this case you can better see what is going on underneath
    (in further I will use generic views and mixing because it's less writing code 😏)




  • Tests

    i used pytest-django to testing my application


    run test using command pytests





KINOMANIA REST API πŸ†•


it is additional rest api application to my previous website KINOMANIA


in this api we have 6 endpoints




  1. /kinomania/movies/for creating and see list all movies


  2. /kinomania/movies/'some Id'/for get movie detail view, update and delete movie


  3. /kinomania/cinema/for get ang create cinema


  4. /kinomania/cinema/'some Id/for get cinema detail view and delete cinema


  5. /kinomania/screening/get and create screening


  6. /kinomania/screening/'some Id'/for get screening detail and delete screening


when user hit in endpoint /kinomania/movies/ he will get list of all movies, every movie has information of this particular url


In this endpoint we have methods like



  1. GET

  2. POST



Home page


when user hit on this url /kinomania/movies/'some Id'/ he will see information about this film, title, description, director and actors (movie can have many actor, but one director)


In this endpoint we have methods like



  1. GET

  2. PUT

  3. DELETE



rest_api_mowie_detail

next user can hit in endpoint /kinomania/cinema/ and he will get list of all cinema with url to films which shown in this cinema


In this endpoint we have methods like



  1. GET

  2. POST



rest_api_cinema_list


next he go to endpoint /kinomania/cinema/'some Id/ and wow, he can get all screenings in this cinema with date and time 😎. cinema can have many film in it and screenings in it


In this endpoint we have methods like



  1. GET

  2. DELETE



Rest_api_delete_cinema

In endpoint /kinomania/screening/ we have list of all screenings with date time movie and cinema, particular screening can has only one movie and only one cinema one


In this endpoint we have methods like



  1. GET

  2. POST



Rest_api_screening_list

and something go wrong and screening must be deleted before it play(because after it play at the cinema this will do for as crontab) at the cinema, we can do this in endpoint /kinomania/screening/'some Id'/


In this endpoint we have methods like



  1. GET

  2. DELETE



Rest_api_delete_screening

To?

run this code python manage.py addactorsdirectorsfilms to add in database actors movies and directors and bee in one wave with me πŸ˜‰



Clone and Run a Django Project

Before diving let’s look at the things we are required to install in our system.

To run Django prefer to use the Virtual Environment

`pip install virtualenv`

Making and Activating the Virtual Environment:-

`virtualenv β€œname as you like”`

`source env/bin/activate`

Installing Django:-

`pip install django`

Now, we need to clone project from Github:-

Above the list of files, click Code.


Copy the URL for the repository.


  • To clone the repository using HTTPS, under "HTTPS", click

  • To clone the repository using an SSH key, including a certificate issued by your organization's SSH certificate authority, click SSH, then click

  • To clone a repository using GitHub CLI, click GitHub CLI, then click


Open Terminal.

Change the current working directory to the location where you want the cloned directory.

Type git clone, and then paste the URL you copied earlier.

`$ git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY`

Press Enter to create your local clone.

```
$ git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY
> Cloning into `Spoon-Knife`...

> remote: Counting objects: 10, done.
> remote: Compressing objects: 100% (8/8), done.
> remove: Total 10 (delta 1), reused 10 (delta 1)
> Unpacking objects: 100% (10/10), done.
```

Install the project dependencies:

`pip install -r requirements.txt`

Now go to the setting.py and change the SECRET_KEY.
from
`SECRET_KEY = os.environ.get('SECRET_KEY')`
to
`SECRET_KEY = 'your own secret key'`
and `DEBUG = True`

create admin account (**remember you must be at the main application folder with file manage.py, and do this steps for
each application in this repository!!!!**)

`python manage.py createsuperuser`

then

`python manage.py makemigrations`

then again run

`python manage.py migrate`

run this command to start periodic tasks in application

`python manage.py crontab add`

run this code to add in database actors movies and directors and bee in one wave with me

`python manage.py addactorsdirectorsfilms`

to start the development server

`python manage.py runserver`

and open localhost:8000 on your browser to view the app.

Have fun

🦁