Skip to main content
Platzi Viewer is a Python-based web application that streams Platzi course content from Google Drive. Follow these steps to install and configure the application.

Prerequisites

Before installing Platzi Viewer, ensure you have:
  • Python 3.7+ installed on your system
  • pip (Python package manager)
  • Git (for cloning the repository)
  • A Google Cloud service account with Drive API access (see Google Drive Setup)
  • A shared Google Drive folder containing Platzi course content

Installation Methods

# Clone the repository
git clone https://github.com/your-username/platzi-viewer.git
cd platzi-viewer

# Create a virtual environment
python -m venv .venv

# Activate the virtual environment
# On Windows:
.venv\Scripts\activate
# On Linux/Mac:
source .venv/bin/activate

# Install dependencies
pip install -r requirements.txt

Core Dependencies

The application requires the following Python packages:
PackageVersionPurpose
requests2.31.0HTTP requests
google-api-python-client2.108.0Google Drive API client
google-auth2.23.0Google authentication
google-auth-oauthlib1.1.0OAuth for Google APIs
google-auth-httplib20.1.1HTTP transport for Google Auth
The requirements.txt file includes optional development dependencies like pytest, black, flake8, and pyinstaller. These are not required for running the application.

Environment Configuration

Create a .env file in the project root to configure the application (optional):
.env
# Server configuration
PORT=8080
HOST=127.0.0.1
PUBLIC_HOST=127.0.0.1

# Google Drive service account
GOOGLE_SERVICE_ACCOUNT_FILE=/path/to/service_account.json
# Alternative: inline JSON credentials
# GOOGLE_SERVICE_ACCOUNT_JSON={"type":"service_account",...}

# Optional: Project paths
# PLATZI_VIEWER_PATH=/path/to/platzi-viewer
# PLATZI_DATA_PATH=/path/to/data

# Progress file size limit (bytes)
MAX_PROGRESS_BYTES=2097152
Never commit your .env file or service_account.json to version control. Add them to your .gitignore file.

Environment Variables Reference

  • PORT: HTTP server port (default: 8080)
  • HOST: Bind address (default: 127.0.0.1, use 0.0.0.0 for Docker/network access)
  • PUBLIC_HOST: Host displayed in logs (default: same as HOST)
  • GOOGLE_SERVICE_ACCOUNT_FILE: Path to service account JSON file
  • GOOGLE_SERVICE_ACCOUNT_JSON: Alternative to file path - full JSON credentials as string
  • PLATZI_VIEWER_PATH: Project root directory (default: current directory)
  • PLATZI_DATA_PATH: Data storage directory (default: same as PLATZI_VIEWER_PATH)
  • MAX_PROGRESS_BYTES: Maximum size for progress.json (default: 2MB)

Service Account Setup

Place your Google Cloud service account JSON file in the project root:
platzi-viewer/
├── service_account.json  # Your credentials file
├── server.py
├── requirements.txt
└── ...
The application searches for credentials in this order:
  1. GOOGLE_SERVICE_ACCOUNT_JSON environment variable (inline JSON)
  2. GOOGLE_SERVICE_ACCOUNT_FILE environment variable (file path)
  3. service_account.json in the executable directory (for PyInstaller builds)
  4. service_account.json in the current working directory
  5. service_account.json in the script directory
See Google Drive Setup for instructions on creating a service account and configuring Drive API access.

Verification

Verify your installation by checking the Python version and imports:
# Check Python version
python --version
# Should show Python 3.7 or higher

# Verify core dependencies
python -c "import requests; print('requests OK')"
python -c "import google.oauth2.service_account; print('google-auth OK')"
python -c "import googleapiclient.discovery; print('google-api-python-client OK')"
All import commands should complete without errors.

Docker Installation Details

When using Docker, the application runs in a containerized environment:
docker-compose.yml
services:
  platzi-viewer:
    build:
      context: .
      dockerfile: Dockerfile
    image: platzi-viewer:latest
    container_name: platzi-viewer
    ports:
      - "8080:8080"
    environment:
      HOST: "0.0.0.0"
      PORT: "8080"
      PUBLIC_HOST: "localhost"
      PLATZI_DATA_PATH: "/data"
      GOOGLE_SERVICE_ACCOUNT_FILE: "/secrets/service_account.json"
    volumes:
      - ./runtime-data:/data
      - ./secrets:/secrets:ro
    restart: unless-stopped
The Docker setup includes:
  • Python 3.13-slim base image
  • Health checks every 30 seconds via /api/health
  • Volume mounts for persistent data (runtime-data/) and read-only secrets (secrets/)
  • Auto-restart policy (unless-stopped)

Building Windows Executable (Optional)

For Windows users, you can create a portable executable:
# Ensure you're in the virtual environment
.venv\Scripts\activate

# Install PyInstaller if not already installed
pip install pyinstaller==6.2.0

# Build portable executable
powershell -ExecutionPolicy Bypass -File .\build_portable_exe.ps1
The executable will be created at dist/PlatziViewer/PlatziViewer.exe with all dependencies bundled.
The build script automatically includes service_account.json if it exists in the project root. For distribution, you may want to exclude this file and have users provide their own credentials.

Next Steps

1

Configure Google Drive

Set up your Google Cloud project and service account to access the Drive API.Go to Google Drive Setup →
2

Build the Cache

Scan your Google Drive folder structure to generate the courses cache.Go to Building Cache →
3

Start the Application

Follow the complete quickstart guide to launch Platzi Viewer.Go to Quickstart →

Troubleshooting

Python Version Issues

If you encounter errors related to Python version:
# Check your Python version
python --version

# On some systems, use python3 explicitly
python3 --version
python3 -m venv .venv

Import Errors

If you see “ModuleNotFoundError”:
# Ensure you're in the virtual environment
source .venv/bin/activate  # Linux/Mac
.venv\Scripts\activate     # Windows

# Reinstall dependencies
pip install -r requirements.txt

Permission Errors

On Linux/Mac, if you encounter permission errors:
# Use --user flag to install in user directory
pip install --user -r requirements.txt

# Or use sudo (not recommended with virtual environments)
sudo pip install -r requirements.txt

Build docs developers (and LLMs) love