{"id":16112735,"url":"https://github.com/dsdatsme/django-video-manager","last_synced_at":"2026-05-07T08:37:06.053Z","repository":{"id":124158703,"uuid":"421190341","full_name":"DSdatsme/django-video-manager","owner":"DSdatsme","description":"Dajngo Video management app with CD automation","archived":false,"fork":false,"pushed_at":"2021-10-26T19:04:38.000Z","size":26,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-12T12:55:21.107Z","etag":null,"topics":["ansible","django"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DSdatsme.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-10-25T21:30:30.000Z","updated_at":"2024-07-25T03:39:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"47a3567d-5b50-4e7a-bdbe-5e0ba5da33f6","html_url":"https://github.com/DSdatsme/django-video-manager","commit_stats":{"total_commits":10,"total_committers":1,"mean_commits":10.0,"dds":0.0,"last_synced_commit":"c1414cc19e1bb1684c13a815e301b7d8f49fbb65"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DSdatsme%2Fdjango-video-manager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DSdatsme%2Fdjango-video-manager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DSdatsme%2Fdjango-video-manager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DSdatsme%2Fdjango-video-manager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DSdatsme","download_url":"https://codeload.github.com/DSdatsme/django-video-manager/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247446634,"owners_count":20940150,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","django"],"created_at":"2024-10-09T20:09:03.354Z","updated_at":"2026-05-07T08:37:05.958Z","avatar_url":"https://github.com/DSdatsme.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!-- no toc --\u003e\n# Video Manager App\n\nThis is a basic Django backend app that does CRUD operations on Videos that are stored on disk.\n\n- [Video Manager App](#video-manager-app)\n  - [Deploy the App](#deploy-the-app)\n    - [Manual Stuff](#manual-stuff)\n    - [Setup](#setup)\n    - [Updating the files](#updating-the-files)\n      - [Updating Django Code](#updating-django-code)\n      - [Updating Nginx Configs](#updating-nginx-configs)\n  - [Accessing the APP (APIs)](#accessing-the-app-apis)\n    - [Upload Video](#upload-video)\n      - [Endpoint](#endpoint)\n      - [Parameters](#parameters)\n      - [Request](#request)\n      - [Response](#response)\n    - [Get Video List](#get-video-list)\n      - [Endpoint](#endpoint-1)\n      - [Request](#request-1)\n      - [Response](#response-1)\n    - [Get Video Data](#get-video-data)\n      - [Endpoint](#endpoint-2)\n      - [Parameters](#parameters-1)\n      - [Request](#request-2)\n      - [Response](#response-2)\n    - [Update Video MetaData](#update-video-metadata)\n      - [Endpoint](#endpoint-3)\n      - [Parameters](#parameters-2)\n      - [Request](#request-3)\n      - [Response](#response-3)\n    - [Delete Video](#delete-video)\n      - [Endpoint](#endpoint-4)\n      - [Parameters](#parameters-3)\n      - [Request](#request-4)\n      - [Response](#response-4)\n  - [OPS](#ops)\n    - [Restarting APP](#restarting-app)\n    - [Check app logs](#check-app-logs)\n    - [Check Database](#check-database)\n    - [Check Nginx](#check-nginx)\n  - [Current Limitations and Future Scope](#current-limitations-and-future-scope)\n    - [App](#app)\n    - [Containerize](#containerize)\n    - [Nginx and SSL](#nginx-and-ssl)\n    - [CI/CD](#cicd)\n\n## Deploy the App\n\nIn this project we use Ansible to deploy the app on a VM. So make sure you have ssh access(with sudo) to VM.\n\n### Manual Stuff\n\n- Updating IP of server in [hosts](ansible/hosts) file.\n- Changing `SERVER_DOMAIN` in [constants.py](video_manager/video_manager/constants.py) to server IP or domain. Also if you are on http, you will have to change `playback_url` that you get in response.\n\n### Setup\n\n- Make sure you have ansible setup from where you plan to run the deploy. You will need to generate GitHub token that you can use to clone private repo(\u003chttps://github.com/settings/tokens/new\u003e) with `repo` access.\n- Updated the **server IP** in hostgroup `django` in inventory `hosts`.\n- Create a file called `vpass` which will be your vault password file with value `aaaa` which is your token value. OR run the command to do the same.\n\n  ```bash\n  echo \"aaaa\" \u003e vpass\n  ```\n\n- Run the playbook (make sure you are in parent folder of repo, no need to cd to any other dir)\n\n  ```bash\n  ansible-playbook -b -K ansible/django_deploy.yml -i ansible/hosts --vault-password-file vpass -u \u003cssh-username\u003e -e \"github_user=\u003cgit-username\u003e\" -e \"github_token=\u003ctoken\u003e\"\n  ```\n\n  The ansible flags may change as per how you want to ssh to servers, but should be more or less same.\n\nThis will setup everything from database, migrations and app.\n\n### Updating the files\n\nBased on usecase, there are ansible tags defined that you can run.\n\n#### Updating Django Code\n\nTo update the code, you need to run the ansible command with the tag `deploy_app`.\n\n#### Updating Nginx Configs\n\nFor Nginx conf update run the tag `nginx_deploy`.\n\n## Accessing the APP (APIs)\n\n\n### Upload Video\n\n\u003cdetails\u003e\n\n\u003csummary\u003eMake a POST request with the local video file path to upload.\u003c/summary\u003e\n\n#### Endpoint\n\n\u003e POST /videos\n\n#### Parameters\n\n`video_file`[REQUIRED]: absolute local file path of video that you want to upload.\n\n`video_name`[REQUIRED]: this will be the name of the video file on server.\n\n`video_folder`[REQUIRED]: name of the folder where the video will be stored. App automatically creates folder if it does not exists. **The value can be empty string or should end with `/`**.\n\n#### Request\n\n```bash\ncurl --location --request POST '\u003cSRVER IP\u003e/videos/' \\\n--form 'video_file=@\"\u003cVIDEO FILE PATH\u003e\"' \\\n--form 'video_name=\"\u003cVIDEO NAME\u003e\"' \\\n--form 'video_folder=\"\u003cDESTINATION VIDEO FOLDER\u003e\"'\n```\n\nExample:\n\n```bash\ncurl --location --request POST '35.154.174.194/videos/' \\\n--form 'video_file=@\"/Users/darshit/test.mp4\"' \\\n--form 'video_name=\"github.mp4\"' \\\n--form 'video_folder=\"ds/videos/\"'\n```\n\n#### Response\n\n```json\n{\n    \"id\": 3,\n    \"video_name\": \"github.mp4\",\n    \"size\": \"5253880\",\n    \"path\": \"ds/videos/\",\n    \"duration\": \"29.568000\",\n    \"codec\": \"mov,mp4,m4a,3gp,3g2,mj2\",\n    \"container\": \"isom\",\n    \"playback_url\": \"https://35.154.174.194/videos/play/ds/videos/github.mp4\"\n}\n```\n\nwhere,\n`size` is size of video in bytes.\n`duration` is video duration in seconds.\n`playback_url` is URL what you can use to play the video.\n\u003c/details\u003e\n\n### Get Video List\n\n\u003cdetails\u003e\n\u003csummary\u003eMake a GET request to list down all the videos in DB.\u003c/summary\u003e\n\n#### Endpoint\n\n\u003e GET /videos\n\n#### Request\n\n```bash\ncurl --location --request GET '\u003cSERVER IP\u003e/videos'\n```\n\nExample:\n\n```bash\ncurl --location --request GET '35.154.174.194/videos'\n```\n\n#### Response\n\nResponse to this GET request is list of videos with all metadata.\n\n```json\n{\n    \"videos\": [\n        {\n            \"id\": 1,\n            \"video_name\": \"testvid.mp4\",\n            \"size\": 1,\n            \"path\": \"dsdatsme/\",\n            \"duration\": 1000.0,\n            \"codec\": \"mov,mp4,m4a,3gp,3g2,mj2\",\n            \"container\": \"isom\",\n            \"playback_url\": \"https://35.154.174.194/videos/play/dsdatsme/testvid.mp4\"\n        },\n        {\n            \"id\": 2,\n            \"video_name\": \"test.mp4\",\n            \"size\": 1,\n            \"path\": \"dsdatsme2/\",\n            \"duration\": 1000.0,\n            \"codec\": \"mov,mp4,m4a,3gp,3g2,mj2\",\n            \"container\": \"isom\",\n            \"playback_url\": \"https://35.154.174.194/videos/play/dsdatsme2/test.mp4\"\n        },\n        ...\n    ]\n}\n```\n\u003c/details\u003e\n\n### Get Video Data\n\n\u003cdetails\u003e\n\u003csummary\u003eMake a GET request with video ID to get it's data.\u003c/summary\u003e\n\n#### Endpoint\n\n\u003e GET /videos/\\\u003cvideo id\u003e\n\n#### Parameters\n\n`video id`[REQUIRED]: is an integer.\n\n#### Request\n\n```bash\ncurl --location --request GET '\u003cSERVER IP\u003e/videos/\u003cVIDEO ID\u003e'\n```\n\nExample:\n\n```bash\ncurl --location --request GET '35.154.174.194/videos/3'\n```\n\n#### Response\n\nResponse will have all video metadata.\n\n```json\n{\n    \"id\": 3,\n    \"video_name\": \"github.mp4\",\n    \"size\": \"5253880\",\n    \"path\": \"ds/videos/\",\n    \"duration\": \"29.568000\",\n    \"codec\": \"mov,mp4,m4a,3gp,3g2,mj2\",\n    \"container\": \"isom\",\n    \"playback_url\": \"https://35.154.174.194/videos/play/ds/videos/github.mp4\"\n}\n```\n\n\u003c/details\u003e\n\n### Update Video MetaData\n\n\u003cdetails\u003e\n\u003csummary\u003eMake a PUT request with following options to update video metadata.\u003c/summary\u003e\n\n\u003e **NOTE**: currently only `path` and `name` updates are supported.\n\n#### Endpoint\n\n\u003e PUT /videos/\\\u003cvideo id\u003e\n\n#### Parameters\n\n`video id`[REQUIRED]: is an integer.\n\n`video_name`[OPTIONAL]: send this if you want to rename a file.\n\n`video_folder`[OPTIONAL]: send this if you want to change the path of the file. **The value can be empty string or should end with `/`**.\n\n#### Request\n\n```bash\ncurl --location --request PUT '\u003cSRVER IP\u003e/videos/\u003cVIDEO ID\u003e' \\\n--form 'video_name=\"\u003cNEW VIDEO NAME\u003e\"' \\\n--form 'video_folder=\"\u003cNEW DESTINATION VIDEO FOLDER\u003e\"'\n```\n\nExample:\n\n```bash\ncurl --location --request PUT '35.154.174.194/videos/3' \\\n--form 'video_name=\"new_github.mp4\"' \\\n--form 'video_folder=\"ds/new_videos/\"'\n```\n\n#### Response\n\n```json\n{\n    \"id\": 3,\n    \"video_name\": \"new_github.mp4\",\n    \"size\": \"5253880\",\n    \"path\": \"ds/new_videos/\",\n    \"duration\": \"29.568000\",\n    \"codec\": \"mov,mp4,m4a,3gp,3g2,mj2\",\n    \"container\": \"isom\",\n    \"playback_url\": \"https://35.154.174.194/videos/play/ds/new_videos/new_github.mp4\"\n}\n```\n\nThe response will have new metadata values along with updated URL.\n\n\u003c/details\u003e\n\n### Delete Video\n\n\u003cdetails\u003e\n\u003csummary\u003eDelete a particular video from server.\u003c/summary\u003e\n\n#### Endpoint\n\n\u003e DELETE /videos/\\\u003cvideo id\u003e\n\n#### Parameters\n\n`video id`[REQUIRED]: is an integer.\n\n#### Request\n\n```bash\ncurl --location --request DELETE '\u003cSERVER IP\u003e/videos/\u003cVIDEO ID\u003e'\n```\n\nExample:\n\n```bash\ncurl --location --request DELETE '35.154.174.194/videos/3'\n```\n\n#### Response\n\nResponse will have all video metadata of the deleted video.\n\n```json\n{\n    \"id\": 3,\n    \"video_name\": \"github.mp4\",\n    \"size\": \"5253880\",\n    \"path\": \"ds/videos/\",\n    \"duration\": \"29.568000\",\n    \"codec\": \"mov,mp4,m4a,3gp,3g2,mj2\",\n    \"container\": \"isom\",\n    \"playback_url\": \"https://35.154.174.194/videos/play/ds/videos/github.mp4\"\n}\n```\n\n\u003c/details\u003e\n\n## OPS\n\n### Restarting APP\n\nSSH to the server and run the following command to restart the app\n\n```bash\nservice video_app restart\n```\n\nTo check the status\n\n```bash\nservice video_app status\n```\n\n### Check app logs\n\n```bash\ntail -f /tmp/video_app.log\n```\n\n### Check Database\n\n```bash\ncd /home/\u003cuser\u003e/video_app/video_manager\ndocker-compose ls       # check running\ndocker-compose restart  # restart DB\n```\n\n### Check Nginx\n\n```bash\nless /etc/nginx/nginx.conf              # main file\nless /etc/nginx/conf.d/video_app.conf   # app conf\n\nservice nginx status                    # check nginx process\nservice nginx restart                   # restart nginx process\nnginx -t                                # test config\n```\n\n## Current Limitations and Future Scope\n\n### App\n\n- Exception handling can be improved as various failure scenarios are not considered.\n- Currently accepts all file format, but the upload will eventyally fail when app runs ffprobe.\n- Video conflicts are checked later stage of the app, should be done before\n- Use of serializers to sanity request and responses.\n- Tests.\n- Limit file size properly.\n\n### Containerize\n\n- Move app to docker container so that we dont need to manage virtual env.\n- Once thats done, it can be easily deployed to k8s cluster and can be easily managed and scaled.\n\n### Nginx and SSL\n\n- Restrict Nginx to listen only single domain.\n- If still plan to use Nginx, add redirect config for HTTP to HTTPS.\n- If planning to move to k8s, use ingress and cert-manager. Example files can be found \u003chttps://github.com/DSdatsme/golang-api-k8s-ci-cd\u003e.\n\n### CI/CD\n\n- Use github actions to run test cases and build docker images. Example: \u003chttps://github.com/DSdatsme/golang-api-k8s-ci-cd\u003e.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdsdatsme%2Fdjango-video-manager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdsdatsme%2Fdjango-video-manager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdsdatsme%2Fdjango-video-manager/lists"}