Skip to content

kofnet002/watchwave

Repository files navigation

Video Platform API built with Django Rest Framework

Django rest framework

Project is hosted live with the front end on mywatchwave.

Default Admin logins for testing purposes.

email: [email protected]
password: amaliTech,services@24

A fully functional Video Platform - Django Rest API project build and tested with restframework and deployed to Heroku.

The project was inspired by AmaliTech as part of their NSS Digital Training programs. Every piece of this project required time and futher reading since I customized most of Django's Djoser library . The activities involved in this project are as follows:

  1. Database model (table) development and configurations
  2. Writing the various API views for all the neccessary methods of each view
  3. Admin panel management configurations.
  4. Adding all the neccesary URL endpoints too for all the various views and thier methods. Not forgetting the admin panel too.
  5. Writing tests for all the views and thier methods. I also used Postman for testing as well.
  6. Including a documentation for the project through a python module called drf-spectacular by OpenAPI Initiative.
  7. Deploy the Django REST API to Heroku

Features

Normal user

  • Create an account with the credentials below
    • username
    • email
    • password
  • Activate your account via link sent by email.
  • Logging in to watch videos.
  • Able to watch next or previous videos in the queue.
  • Share video links across all platforms

Admin

  • Loggin in to upload videos with
    • title
    • description
    • video file
  • Able to manage videos on the dasboard which will reflects on the hosted db

Image of the WebAPI

Backe end view

Images of the Front End Application

Front end view Front end view

Technologies used for building the system

  1. Django Rest Framework for handling the API views and URLs.

  2. Cloudinary for hosting the videos and the video previews when scrubbing the timeline. Video Previews are the images that show when the user hovers over the timeline of the video player. Create and account on Cloudinary and get the following credentials

  • CLOUDINARY_CLOUD_NAME
  • CLOUDINARY_API_KEY
  • CLOUDINARY_API_SECRET
  1. I built the Front end like the youtube video player.

  2. Supabase for Database management and hosting of a few static images as well.

  3. Heroku for hosting the application.

  4. SendGrid, the platform I used for sending Emails. Create and account and get your API for sending emails.

Prerequisites

    python
    django
    djanfo-restframework

Project setup

  1. Clone this repository

    git clone https://github.com/kofnet002/watchwave.git

    cd watchwave
  1. Create a virtual environment to manage the packages & activate it

    python -m venv venv

    .venv/bin/activate => for linux

    venv\Scripts\activate => for windows
  1. Install all the neccessary packages/dependencies

    pip install -r requirements.txt
  1. Setup environment variables

  • In the root directory, create the file .env and the following environment variables
SECRET_KEY = <any long random combination for alphabets and numbers>

================ DB CONFIGURATION ===================
There are 2 ways of setting up the database configuration, in the settings.py file, I used the approach 1

================ APPROACH 1 ================
DATABASES['default'] = dj_database_url.config(
    default='postgres://user:password@localhost:port/dbname',
)

================ APPROACH 2 ================
If you go by this approach, make sure to add the necessary credentials as stated below.

ENGINE = 'django.db.backends.postgresql'
NAME = your db name
HOST = your db host
USER = your db user
PASSWORD= your db password
PORT='5432'

SITE_NAME = 'WatchWave' # Site name that will show on the admin dasboard as well as the emai the user will receive

ADMIN_SITE_HEADER = 'WatchWave' # Head on the admin dashboard

DOMAIN = 'mywatchwave.vercel.app' # Frontend domain without the domain


================ EMAIL CONFIGURATION ===================
Create an app from Gmail and get the app password

_EMAIL_HOST_PASSWORD = <your Gmail app password # For sending emails>
DEFAULT_FROM_EMAIL = <your account to send the mail from  # eg. [email protected]>


================ CLOUDINARY CONFIGURATION ===================
CLOUDINARY_CLOUD_NAME = your cloudinary cloud name
CLOUDINARY_API_KEY= your cloudinary api key
CLOUDINARY_API_SECRET = your cloudinary api secret

  1. In the root directory of the project in the terminal, run the code below to create a superuser to manage all the users of the application. be sure python is installed before you proceed with this stage. The application needs you to activate your account first, but as a super admin, your account will be activated by default.
    python manage createsuperuser
  1. Run the program with the following command

    python manage.py runserver

Open your broswer and then visit http://127.0.0.1:8000 or localhost:8000

Admin

Since some extra work is being done in the background when uploading videos, the admin dasboard provided by django is not suitable for uploading videos. Instead you can visit Admin dashboard to upload videos on the frontend or you can equally use postman as well.

Behind the scene when uploading a video

  • I leverage the power of ffmpeg to snapshot the current uploading video every 10s and save it along with the video. The snapshots or the video previews displays just like YouTube. That is when you hover the mouse over the video timeline, the video previews will show on the screen and on the timeline as well.

Get Involved

We welcome contributions and participation from the community to help make this e-commerce backend API even better! Whether you're looking to fix bugs, add new features, or improve documentation, your help is greatly appreciated. Here's how you can get involved:

Reporting Issues 🚩

If you encounter any bugs or issues, please report them using the Issues section of my GitHub repository. When reporting issues, please include:

  • A clear and descriptive title.
  • A detailed description of the problem, including steps to reproduce it.
  • Any relevant logs or error messages. Your environment details (e.g., Django version, DRF version, database, etc.).

Contributing Code πŸ’πŸΌ

I love receiving pull requests from the community! If you have an improvement or a new feature you'd like to add, please feel free to do so πŸ‘

About

A fully functional Video Platform - Django Rest API project build and tested with restframework

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •