A comprehensive video streaming platform built with Django, featuring content management, user subscriptions, payment processing, and analytics.
Video Platform is a full-featured video streaming solution designed for delivering premium and free video content. The platform includes live streaming capabilities, user authentication, subscription management, content moderation, and comprehensive analytics.
- Video upload and streaming with thumbnail support
- Live streaming capabilities
- Video categorization and tagging system
- Playlist creation and management
- Premium and free content tiers
- Video pricing and purchase system
- Featured content management
- Watch history tracking
- Video duration and metadata management
- Custom user authentication system
- User profiles with avatar and bio
- User following system
- Watch history and favorites
- Comment system with nested replies
- Like and dislike functionality for videos and comments
- Subscription plans (monthly and yearly)
- Individual video purchases
- Payment processing integration
- Payment history tracking
- Subscription expiry management
- Transaction management
- Category-based organization
- Tag system for content discovery
- Advanced search and filtering
- Trending content
- Browse by category
- Content moderation and reporting system
- Analytics dashboard for users, videos, and platform
- RESTful API with token authentication
- Responsive design for mobile and desktop
- DRM support for secure video streaming
- Django 4.x
- Django REST Framework
- Celery for background tasks
- Redis for caching and task queue
- SQLite (development)
- PostgreSQL ready (production)
- HTML5, CSS3, JavaScript
- Responsive design
- Docker and Docker Compose support
- Gunicorn for production deployment
- WhiteNoise for static file serving
- AWS S3 ready for media storage
Video-platform/
├── accounts/ # User authentication and profile management
├── videos/ # Video content management and streaming
├── payments/ # Payment processing and subscriptions
├── categories/ # Category management
├── tags/ # Tagging system
├── moderation/ # Content moderation and reporting
├── analytics/ # Analytics and reporting
├── templates/ # HTML templates
├── static/ # Static files (CSS, JS, images)
├── media/ # User uploaded media files
├── video_platform/ # Main project configuration
└── manage.py # Django management script
- Python 3.8 or higher
- pip
- virtualenv (recommended)
- Redis (for Celery and caching)
- PostgreSQL (optional, for production)
Clone the repository
git clone <repository-url>cd Video-platform
Create and activate virtual environment
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
Install dependencies
pip install -r requirements.txt
Configure environment variables Create a
.envfile in the project root:SECRET_KEY=your-secret-key-hereDEBUG=TrueALLOWED_HOSTS=localhost,127.0.0.1DATABASE_URL=sqlite:///db.sqlite3CELERY_BROKER_URL=redis://localhost:6379/0EMAIL_BACKEND=django.core.mail.backends.console.EmailBackendPAYMENT_GATEWAY_KEY=your-payment-gateway-key
Run migrations
python manage.py makemigrations python manage.py migrate
Create superuser
python manage.py createsuperuser
Collect static files
python manage.py collectstatic
Run development server
python manage.py runserver
The application will be available at http://localhost:8000
docker-compose up --buildThis will:
- Build the Docker image
- Run database migrations
- Collect static files
- Start the Gunicorn server on port 8000
Required environment variables:
SECRET_KEY: Django secret key (required in production)DEBUG: Debug mode (True/False)ALLOWED_HOSTS: Comma-separated list of allowed hostsDATABASE_URL: Database connection stringCELERY_BROKER_URL: Redis connection URL for CeleryEMAIL_BACKEND: Email backend configurationEMAIL_HOST: SMTP server hostEMAIL_PORT: SMTP server portEMAIL_USE_TLS: Use TLS for email (True/False)EMAIL_HOST_USER: SMTP usernameEMAIL_HOST_PASSWORD: SMTP passwordDEFAULT_FROM_EMAIL: Default sender emailPAYMENT_GATEWAY_KEY: Payment gateway API keyVIDEO_STREAMING_SERVER: Video streaming server URL for DRM
The project uses SQLite by default for development. For production, update the database settings in video_platform/settings.py to use PostgreSQL:
DATABASES= {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'your_database_name',
'USER': 'your_database_user',
'PASSWORD': 'your_database_password',
'HOST': 'localhost',
'PORT': '5432',
}
}The platform includes REST API endpoints for:
- User authentication (
/api/auth/) - Video management (
/api/videos/) - Category listing (
/api/categories/) - Payment processing (
/api/payments/) - User profiles (
/api/accounts/)
API documentation is available at /api/docs/ when running the development server.
The API uses token-based authentication. Obtain a token by logging in through the API:
POST /api/auth/login/
{
"username": "your_username",
"password": "your_password"
}Include the token in subsequent requests:
Authorization: Token your_token_here
python manage.py testFollow PEP 8 guidelines for Python code. Use Django's coding style for templates and views.
Start Celery worker for background tasks:
celery -A video_platform worker -l infoStart Celery beat for scheduled tasks:
celery -A video_platform beat -l info- Set
DEBUG = Falsein settings - Configure proper
ALLOWED_HOSTS - Set up production database (PostgreSQL recommended)
- Configure static file serving (WhiteNoise or CDN)
- Set up media file storage (AWS S3 or similar)
- Configure email backend with real SMTP service
- Set up SSL/HTTPS
- Configure Celery and Redis for background tasks
- Set up monitoring and logging
- Configure backup strategy
- Set up error tracking (Sentry recommended)
- Web Server: Gunicorn or uWSGI
- Reverse Proxy: Nginx
- Database: PostgreSQL
- Cache: Redis
- Media Storage: AWS S3 or similar
- Task Queue: Celery with Redis broker
- Process Manager: Supervisor or systemd
The platform includes comprehensive security features:
- CSRF protection enabled
- XSS protection
- SQL injection protection (Django ORM)
- Secure password hashing
- Session security
- Content Security Policy ready
- Secure cookie settings in production
- HSTS headers configured
CustomUser: Extended user model with phone number supportUserProfile: User profile with subscription and avatarVideo: Video content with metadata, pricing, and categorizationCategory: Video categoriesTag: Content tagsPlaylist: User-created playlistsComment: Video comments with nested repliesPayment: Payment transactionsSubscription: User subscriptionsVideoPurchase: Individual video purchasesWatchHistory: User watch history tracking
This project is proprietary software. All rights reserved.
For issues, questions, or contributions, please contact the development team.