A powerful Python-based movie streaming server that provides a sleek web interface for browsing and streaming movies with comprehensive admin management capabilities. Built with Flask and designed for both personal and small-scale commercial use.
- π₯ High-Quality Movie Streaming: Stream movies directly through the web interface with smooth playback
- πΌοΈ Visual Movie Gallery: Beautiful poster displays for enhanced browsing experience
- π¨βπΌ Advanced Admin Panel: Secure administrative interface for complete movie management
- π± Responsive Design: Fully mobile-friendly interface that works on all devices
- π Secure Authentication: Robust admin login system with session management
- π JSON Database: Lightweight, fast movie metadata storage system
- π Production Ready: WSGI compatible with Gunicorn for deployment
- π¨ Modern UI/UX: Clean, intuitive interface with custom CSS and JavaScript
- Python 3.7+
- Flask 2.3.3+
- Werkzeug 2.3.7+
- Gunicorn 21.2.0+ (for production deployment)
See requirements.txt for complete dependency list.
Ensure you have Python 3.7+ installed on your system.
-
Clone the repository
git clone https://github.com/khaliduzzamantanoy/pyftp.git cd pyftp -
Create a virtual environment
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Run the application
python app.py
-
Access the application
- Open your browser and navigate to
http://localhost:5000 - For admin access, go to
http://localhost:5000/admin
- Open your browser and navigate to
π That's it! Your movie server is now running and ready to use.
Run the application in development mode with hot reload:
python app.pyThe server will start on http://localhost:5000 with debug mode enabled.
For production deployment using Gunicorn:
# Basic production run
gunicorn --bind 0.0.0.0:8000 wsgi:app
# Advanced production with multiple workers
gunicorn --bind 0.0.0.0:8000 --workers 4 --timeout 300 wsgi:app# Build the image
docker build -t pyftp-server .
# Run the container
docker run -p 8000:8000 -v $(pwd)/static/movies:/app/static/movies pyftp-serverAccess the powerful admin interface at /admin to manage your movie server:
- π Dashboard: Overview of total movies, storage usage, and server stats
- β Add Movies: Upload and add new movies with metadata
- βοΈ Edit Movies: Modify movie information, posters, and descriptions
- ποΈ Delete Movies: Remove movies and associated files
- βοΈ Server Settings: Configure server parameters and preferences
- π₯ User Management: Handle admin users and permissions
- π Analytics: View streaming statistics and popular content
- Username:
admin - Password:
admin
β οΈ Security Notice: Change default credentials immediately after first login!
Configure your application using environment variables:
# Application Settings
FLASK_ENV=production # development or production
SECRET_KEY=your-super-secret-key-here # Generate a strong secret key
DEBUG=False # Enable/disable debug mode
# Admin Settings
ADMIN_USERNAME=your_admin_username # Custom admin username
ADMIN_PASSWORD=your_secure_password # Strong admin password
# Server Settings
HOST=0.0.0.0 # Server host
PORT=5000 # Server port
MAX_CONTENT_LENGTH=5368709120 # Max upload size (5GB)
# Database Settings
MOVIES_DB_PATH=data/movies.json # Movies database file path
UPLOAD_FOLDER=static/movies # Movies upload directoryModify app.py to customize advanced settings:
# Server Configuration
app.config['MAX_CONTENT_LENGTH'] = 5 * 1024 * 1024 * 1024 # 5GB max file size
app.config['UPLOAD_FOLDER'] = 'static/movies'
app.config['ALLOWED_EXTENSIONS'] = {'mp4', 'avi', 'mkv', 'mov'}
# Security Configuration
app.config['SESSION_PERMANENT'] = False
app.config['SESSION_TYPE'] = 'filesystem'| Method | Endpoint | Description | Parameters |
|---|---|---|---|
GET |
/ |
Main movie browsing page | None |
GET |
/movie/<movie_id> |
Stream specific movie | movie_id: Movie identifier |
GET |
/poster/<movie_id> |
Get movie poster | movie_id: Movie identifier |
GET |
/search |
Search movies | q: Search query |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
GET |
/admin |
Admin login page | No |
POST |
/admin/login |
Admin authentication | No |
GET |
/admin/panel |
Admin dashboard | Yes |
POST |
/admin/upload |
Upload new movie | Yes |
PUT |
/admin/movie/<movie_id> |
Update movie info | Yes |
DELETE |
/admin/movie/<movie_id> |
Delete movie | Yes |
GET |
/admin/stats |
Server statistics | Yes |
{
"status": "success|error",
"data": {...},
"message": "Response message",
"timestamp": "2025-06-11T10:30:00Z"
}- π Session-based Authentication: Secure admin login with session management
- π‘οΈ CSRF Protection: Cross-site request forgery protection
- π File Type Validation: Strict file type checking for uploads
- π Secure File Handling: Safe file upload and storage mechanisms
- π§Ή Input Sanitization: All user inputs are sanitized and validated
- π« Path Traversal Protection: Prevents directory traversal attacks
- π Secret Key Management: Secure session key configuration
-
Install Gunicorn
pip install gunicorn
-
Create systemd service (
/etc/systemd/system/pyftp.service):[Unit] Description=PyFTP Movie Server After=network.target [Service] User=www-data Group=www-data WorkingDirectory=/path/to/pyftp Environment="PATH=/path/to/pyftp/venv/bin" ExecStart=/path/to/pyftp/venv/bin/gunicorn --workers 4 --bind unix:pyftp.sock -m 007 wsgi:app Restart=always [Install] WantedBy=multi-user.target
-
Configure Nginx (
/etc/nginx/sites-available/pyftp):server { listen 80; server_name your-domain.com; client_max_body_size 5G; location / { include proxy_params; proxy_pass http://unix:/path/to/pyftp/pyftp.sock; proxy_read_timeout 300s; proxy_connect_timeout 75s; } location /static { alias /path/to/pyftp/static; expires 1y; add_header Cache-Control "public, immutable"; } }
-
Create Dockerfile:
FROM python:3.9-slim WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ ffmpeg \ && rm -rf /var/lib/apt/lists/* # Copy and install Python dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy application code COPY . . # Create non-root user RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app USER appuser EXPOSE 8000 CMD ["gunicorn", "--bind", "0.0.0.0:8000", "--workers", "4", "wsgi:app"]
-
Create docker-compose.yml:
version: "3.8" services: pyftp: build: . ports: - "8000:8000" volumes: - ./static/movies:/app/static/movies - ./data:/app/data environment: - FLASK_ENV=production - SECRET_KEY=your-production-secret-key restart: unless-stopped
-
Deploy:
docker-compose up -d
# Install Heroku CLI and login
heroku create your-app-name
heroku config:set FLASK_ENV=production
heroku config:set SECRET_KEY=your-secret-key
git push heroku main# Launch EC2 instance and connect
sudo apt update && sudo apt install python3-pip nginx
git clone https://github.com/khaliduzzamantanoy/pyftp.git
cd pyftp
pip3 install -r requirements.txt
# Configure nginx and systemd as shown aboveWe welcome contributions from the community! Here's how you can help:
- π Bug Reports: Found a bug? Open an issue with detailed reproduction steps
- π‘ Feature Requests: Have an idea? We'd love to hear it!
- π§ Code Contributions: Submit pull requests for bug fixes or new features
- π Documentation: Help improve our documentation
- π¨ UI/UX Improvements: Make the interface even better
-
Fork and Clone
git clone https://github.com/your-username/pyftp.git cd pyftp -
Create Development Environment
python -m venv venv source venv/bin/activate pip install -r requirements.txt pip install -r requirements-dev.txt # Development dependencies
-
Create Feature Branch
git checkout -b feature/amazing-new-feature
-
Make Changes and Test
python app.py # Test your changes -
Submit Pull Request
git add . git commit -m "Add amazing new feature" git push origin feature/amazing-new-feature
- Follow PEP 8 for Python code
- Use meaningful variable and function names
- Add comments for complex logic
- Write docstrings for functions and classes
- Test your changes thoroughly
- Update documentation if needed
- Add tests for new features
- Ensure all tests pass
- Update the changelog
- Request review from maintainers
This project is licensed under the MIT License - see the LICENSE file for complete details.
MD Khaliduzzaman Tanoy
- π GitHub: @khaliduzzamantanoy
- π§ Email: Contact via GitHub
- π Project: PyFTP Movie Server
- πΌ LinkedIn: Connect with me
- π Documentation: Check this README and inline code comments
- π Issues: GitHub Issues
- π§ Email: Reach out via GitHub for complex issues
Movie won't play?
- Check file format compatibility (MP4 recommended)
- Verify file permissions in the movies directory
- Ensure adequate server resources
Admin panel not accessible?
- Verify admin credentials
- Check if session is active
- Clear browser cache and cookies
Upload failing?
- Check file size limits (default 5GB)
- Verify available disk space
- Ensure proper folder permissions
If you find PyFTP Movie Server useful:
- β Star this repository on GitHub
- π Report bugs and suggest improvements
- π€ Contribute code or documentation
- π¬ Share with others who might benefit
- π Write a review or tutorial
Special thanks to:
- Flask Community for the amazing web framework
- Bootstrap Team for responsive design components
- Contributors who help improve this project
- Users who provide valuable feedback and bug reports
- Open Source Community for inspiration and tools
β If you find this project useful, please consider giving it a star on GitHub! β
Made with β€οΈ by MD Khaliduzzaman Tanoy