A Django Rest Framework that generates Movies url's from a local storage and serves them to clients.
Create a virtual environment to work on by running virtualenv venv -p python3
. Activate It through source venv/bin/activate
and then
Clone the repo by running git clone git@github.com:esirK/JibambexApi.git
.
Change into the JibambeApi folder and run pip install -r requirements.txt
which will install all the required packages.
Now You almost there.
To get you database ready, run python manage.py makemigrations movies
then python manage.py migrate
. You will need
a super user account during development which you can create through python manage.py createsuperuser
. Fill in detals asked and you are good to go.
run
python manage.py runserver 0.0.0.0:8000
the 0.0.0.0:8000 will ensure that your server is listening on any IPv4 address available and can be accessed by any other user on the same network. i.e If the IP Address of your machine is 192.168.1.143, then from any other machine on the same network you can use the address http://192.168.1.143:8000/moviescategories/ to access the moviescategories.
For now Access the running Api from http://127.0.0.1:8000/moviescategories/ to see available movie categories which are empty by default.
To populate the movies categories, you will need to setup your file system as follows
- Inside the movies app, create a folder named static
- Inside the static folder, create a folder named movies
- Create a categories folder inside the movies folder
Inside the categories folder created in step 3 above is where you should place different movie categories folders.
As an example, create a category named Horror and inside it add an image file (Find a horror image 😱)
Now find a Horror Movie and its image/thumbnail. Place them in a folder named as the movie or any other name
Finally run python manage.py populate_categories && python manage.py collectstatic
.
Navigate back to http://127.0.0.1:8000/moviescategories/ to see available movie categories which now should contain the horror category created above.
You can use the Django Admin site to play around with different models. Navigate to http://127.0.0.1:8000/admin/
To access movies in a single category, navigate to http://127.0.0.1:8000/moviescategories/{id} where id is the id of the Movies category
- Isaiah Ngaruiya - Initial work