The Pinguo Dashboard Backend powers the core functionality of the teacher-side admin interface in the Pinguo language learning platform. Built using Django and Django REST Framework, this backend handles content creation, test management, media storage, JWT authentication, and integration with a React frontend dashboard.
- π Course & Lesson Management
- π£οΈ Dialogue Groups with Audio & Image Modals
- π§ Custom Test Cards with Multiple Answer Types
- π JWT-Based Authentication
- π Cloud Media Storage (DigitalOcean Spaces via S3)
- π€ REST API Endpoints for Frontend Integration
- π§© Dynamic Drag & Drop Item Management
- ποΈ Admin Interface via Django + Jazzmin
dashboard\_backend/
βββ dashboard\_backend/ # Project settings & root config
βββ course/ # Lessons, metadata & course-related models
βββ dialogue/ # Dialogue, Balloons, Images, Test Cards
βββ word\_card/ # Word flashcards or related resources
βββ dictionary/ # Dictionary entries and utilities
βββ alerts/ # Notification & alert system
βββ authorization/ # JWT Auth & User profile extensions
βββ media/ / static/ # (Optional) Local storage fallback
Handles conversational data:
DialogueGroup: A container for dialogues in a lessonDialogue: Contains audio, image, and text balloon entriesBallon: Holds text + audio + ideogram + pronunciationImageModal: Hints-based image cards for visual learningTestCardandTestAnswer: Custom quiz system per dialogue
Each TestCard belongs to a DialogueGroup, referencing:
- Dialogue
- Related Balloon
- Answers (
ideogram,pinyin, ormeaningtype)
Includes automatic linking in the dialogue arrangement list.
- Python 3.10+
- Django 4.1+
- PostgreSQL / SQLite
pipenvorvenvfor environment management
git clone https://github.com/your-org/pinguo-dashboard-backend.git
cd pinguo-dashboard-backend
# Create virtual env
python -m venv venv
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Set environment variables (use .env file)
cp .env.example .envSECRET_KEY=your_secret_key
DEBUG=True
# AWS S3 (DigitalOcean Spaces or other)
AWS_ACCESS_KEY_ID=...
AWS_SECRET_ACCESS_KEY=...
AWS_STORAGE_BUCKET_NAME=...
AWS_S3_ENDPOINT_URL=...
AWS_LOCATION=static
AWS_MEDIA_LOCATION=mediapython manage.py makemigrations
python manage.py migrate
python manage.py createsuperuserpython manage.py runserverUse JWT via /api/token/ and /api/token/refresh/ endpoints.
Headers for authenticated routes:
Authorization: Bearer <your_access_token>Uses DigitalOcean Spaces (or any S3-compatible service) for:
- Media:
MEDIA_URL - Static files:
STATIC_URL
Uses Django's storages and boto3.
- JWT Authentication via
rest_framework_simplejwt - CORS open to all (
CORS_ORIGIN_ALLOW_ALL=True) β restrict in production
Powered by Jazzmin, for an enhanced Django Admin UI.
rest_frameworkrest_framework_simplejwtcorsheadersdecouplefor configstorages+boto3for file hosting
Dialogue Content Models
DialogueGroupβDialogueβBallon,ImageModalTestCardβTestAnswerDGItemListMainβ handles drag-n-drop ordering & dynamic updates
# Dockerfile
FROM python:3.10-slim
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# Set working directory
WORKDIR /app
# Install dependencies
COPY requirements.txt .
RUN pip install --upgrade pip && pip install -r requirements.txt
# Copy project files
COPY . .
# Collect static files (if needed)
RUN python manage.py collectstatic --noinput
# Expose port
EXPOSE 8000
# Run the app
CMD ["gunicorn", "dashboard_backend.wsgi:application", "--bind", "0.0.0.0:8000"]version: "3.9"
services:
web:
build: .
command: gunicorn dashboard_backend.wsgi:application --bind 0.0.0.0:8000
ports:
- "8000:8000"
volumes:
- .:/app
env_file:
- .env
depends_on:
- db
db:
image: postgres:14
environment:
POSTGRES_DB: pinguo
POSTGRES_USER: rootuser
POSTGRES_PASSWORD: rootuser9683
volumes:
- postgres_data:/var/lib/postgresql/data
volumes:
postgres_data:__pycache__/
*.pyc
*.pyo
*.pyd
*.sqlite3
env/
venv/
*.env
/media
/static
name: Django CI/CD
on:
push:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:14
env:
POSTGRES_DB: pinguo
POSTGRES_USER: rootuser
POSTGRES_PASSWORD: rootuser9683
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
DEBUG: 0
SECRET_KEY: ${{ secrets.SECRET_KEY }}
DB_NAME: pinguo
DB_USER: rootuser
DB_PASSWORD: rootuser9683
DB_HOST: localhost
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run migrations
run: |
python manage.py makemigrations
python manage.py migrate
- name: Run tests
run: |
python manage.py testπ Store sensitive variables (e.g.,
SECRET_KEY, DB creds) in GitHub repo secrets.
This project is private and proprietary to the Pinguo development team. Unauthorized use or distribution is prohibited.
Maintained by the SUJAL DATTARAO BHAKARE.