Parody News Generator¶
A Django-based web application integrated with OpenAI to generate AI-powered parody news content. This project combines modern web development practices with artificial intelligence to create a platform for generating and managing satirical news articles.
οΏ½ Successfully Deployed on Azure Container Apps! This application is now live and running in production. See DEPLOYMENT-SUCCESS.md for deployment details and DEPLOYMENT-GUIDE-MINIMAL.md for setup instructions.
οΏ½π¨βπ» Developers: Looking for a quick technical setup? See the Developer Guide for concise commands and architecture overview. For critical insights (don't read!), check DONTREADME.md.
AI Development Notes: This README centralizes all repo contents into a comprehensive narrative. Explore the codebase, understand AI integrations, document changes, manage machines (infrastructure), and handle everything else through this hub.
Table of Contents¶
- Features
- Technology Stack
- Architecture & Design Patterns
- Configuration & Environment
- Project Structure
- Prerequisites
- Installation & Setup
- Running the Application
- Docker Setup
- Azure Deployment
- Deployment Success
- Cost Optimization
- Testing
- Development Container Workflow
- Contributing
- Changelog
- License
- Screenshots
- Meta-Notes: AAR Recursion Applied
Features¶
Features¶
Core Features¶
- AI-Powered Content Generation: Leverages OpenAI APIs to generate parody news articles with customizable prompts
- User Authentication: Complete user management with registration, login, logout, and password management
- Dynamic Content Management: Django admin interface for managing content, users, and site settings
- RESTful API: Full-featured API for programmatic interaction with application data
- Responsive Design: Bootstrap 5.3.3-based responsive UI that adapts to various screen sizes
- Blog Module: Integrated blog with categories, tags, and content management
- Search Functionality: Built-in search for finding content across the site
- Security Features: Django's built-in security protections against XSS, CSRF, SQL Injection, and more
Advanced Features¶
- Dynamic Form Support: Reusable Django forms with validation and error handling
- Streamlined Templates: Clean Django template system with Bootstrap integration
- Jekyll Static Site Generation: Integrated Jekyll for static content and blog publishing
- Enhanced Navigation: YAML-based navigation and UI text management
- GitHub Automation: AI-assisted GitHub issue handling and repository management
- Email Integration: Django email support for notifications and user communications
- Docker-First Development: Complete containerization for consistent environments
- Azure Cloud Deployment: Production-ready deployment on Azure Container Apps
Recent Updates (v0.2.0)¶
- β Successful Azure Deployment: Live production deployment on Azure Container Apps
- π§ Streamlined Architecture: Removed CMS dependencies for simplified deployment and maintenance
- π° Cost Optimization: Minimal cost infrastructure with Bicep templates
- π Comprehensive Documentation: Complete deployment guides and troubleshooting resources
Technology Stack¶
Backend Framework & Tools¶
- Django 4.2.20: High-level Python web framework for rapid development
- Django REST Framework: Powerful toolkit for building Web APIs
- Python 3.8+: Primary programming language
- Gunicorn: WSGI HTTP server for production deployment
Frontend & UI¶
- Bootstrap 5.3.3: Responsive front-end toolkit for modern web design
- jQuery: JavaScript library for DOM manipulation (optional)
- Pure Django Templates: Streamlined template system without CMS dependencies
Databases¶
- PostgreSQL: Database for development, testing, and production
Infrastructure & Deployment¶
- Docker & Docker Compose: Containerization for consistent development and deployment
- Azure Container Apps: β Successfully Deployed - Cloud container hosting service
- Azure Developer CLI (azd): Tool for provisioning and deploying Azure resources
- Azure Bicep: Infrastructure as Code (IaC) for Azure resources
- Azure Application Insights: Monitoring and diagnostics
- Jekyll: Static site generator for blog content
AI Integration¶
- OpenAI API: Access to GPT models for content generation
- Custom OpenAI Integration: Configurable AI services for specialized content creation
Testing & Quality Assurance¶
- Pytest: Python testing framework
- Pytest-Django: Django plugin for pytest
- Playwright: End-to-end browser testing
- Selenium: Web automation and testing
- Coverage.py: Code coverage measurement
- Ruff: Fast Python linter
Development Tools¶
- Git & GitHub: Version control and collaboration
- VS Code: Recommended IDE with Dev Container support
- GitHub Codespaces: Cloud-based development environments
- Sphinx: Documentation generation
Architecture & Design Patterns¶
Core Patterns¶
MVC (Model-View-Controller) - Clear separation of concerns with Django models, views, and templates - Models define data structure and business logic - Views handle request/response logic - Templates manage presentation layer
RESTful API Design - Django REST Framework for structured API endpoints - Serializers for data validation and transformation - ViewSets for consistent CRUD operations - Token-based authentication support
Template Management - Django templating system with inheritance and includes - Bootstrap integration for responsive layouts - Custom template tags and filters - Context processors for global template variables
Infrastructure Patterns¶
Infrastructure as Code (IaC) - Azure Bicep files for cloud resource provisioning - Declarative infrastructure definitions - Version-controlled infrastructure changes - Automated deployment pipelines
Containerization - Multi-stage Dockerfiles for optimized images - Docker Compose for local development orchestration - Separate containers for app, database, and Jekyll services - Volume mounts for hot-reload development
Security & Best Practices¶
Security Features - Django built-in protections (XSS, CSRF, SQL Injection) - Secure password hashing with PBKDF2 - HTTPS enforcement in production - Content Security Policy headers - DKIM email authentication
Middleware & Context Processors - Custom middleware for authentication and request processing - Context processors for CMS integration - Localization support via Django's i18n framework
Logging & Monitoring - Azure Application Insights integration - Structured logging throughout the application - Performance metrics collection - Error tracking and alerting
Configuration & Environment¶
Enterprise-Grade Configuration Management¶
Barodybroject features a completely optimized Django configuration system designed for enterprise production deployment while maintaining excellent developer experience.
Key Configuration Features: - 12-Factor App Compliance: All configuration through environment variables - Multi-Environment Support: Development, staging, and production configurations - AWS Secrets Manager Integration: Secure production secrets management - Environment Auto-Detection: Intelligent environment detection and configuration - Security-First Design: Secure defaults with development overrides - Performance Optimization: Production-tuned caching, database, and static file settings
Environment Profiles¶
Development Environment¶
- Database: PostgreSQL
- Caching: Local memory cache for fast development
- Security: Relaxed settings for easy debugging
- Email: Console backend for testing
- Debug Tools: Optional Django Debug Toolbar support
Production Environment¶
- Database: PostgreSQL with connection pooling and SSL
- Caching: Redis with intelligent database fallback
- Security: Enterprise-grade security headers and HTTPS enforcement
- Email: AWS SES with DKIM authentication
- Monitoring: Comprehensive structured logging with JSON formatting
- Static Files: Optimized static file serving with manifest storage
Configuration Documentation¶
For comprehensive configuration guidance, see our detailed documentation:
- Django Settings Optimization Guide - Complete 100+ page configuration guide
- Environment Configuration Reference - Environment variable reference and validation
- Security Configuration Guide - Security best practices and implementation
- Performance Configuration Guide - Performance optimization strategies
Quick Configuration Setup¶
Development Setup¶
# Copy environment template
cp .env.example .env
# Edit environment variables for development
RUNNING_IN_PRODUCTION=False
DEBUG=True
DB_CHOICE=postgres
Production Deployment¶
# Set production environment variables
RUNNING_IN_PRODUCTION=True
DEBUG=False
SECRET_KEY=your-ultra-secure-secret-key
DB_PASSWORD=your-secure-database-password
AWS_ACCESS_KEY_ID=your-aws-access-key
REDIS_URL=redis://your-redis-host:6379/1
Configuration Validation¶
# Validate development configuration
python manage.py check
# Validate production deployment configuration
python manage.py check --deploy
# Test environment variable loading
python scripts/validate_env.py production
Project Structure¶
barodybroject/
βββ docs/ # Comprehensive project documentation
β βββ configuration/ # Django configuration documentation
β β βββ README.md # Configuration documentation overview
β β βββ settings-optimization.md # Complete Django settings guide (100+ pages)
β β βββ environment-config.md # Environment variable reference
β β βββ security-config.md # Security configuration guide
β β βββ performance-config.md # Performance optimization guide
β βββ changelog/ # Change documentation and templates
β βββ README.md # Documentation system overview
β βββ CHANGELOG.md # Main project changelog
β βββ CONTRIBUTING_CHANGES.md # Change contribution guidelines
β βββ templates/ # Standardized change templates
β βββ releases/ # Release-specific documentation
β βββ summaries/ # Date-organized change summaries
β βββ archive/ # Historical documentation files
βββ infra/ # Azure infrastructure as code (Bicep)
β βββ main.bicep # Main infrastructure definition
β βββ app/ # Application-specific resources
β βββ shared/ # Shared resources (Key Vault, monitoring, etc.)
βββ scripts/ # Deployment and automation scripts
β βββ azure-setup.py # Azure setup automation
β βββ version-manager.sh # Version management
βββ src/ # Django application source code
β βββ barodybroject/ # Django project settings
β β βββ settings.py # Enterprise-grade application configuration (950+ lines)
β β βββ urls.py # URL routing
β β βββ wsgi.py # WSGI application entry point
β βββ parodynews/ # Main Django app
β β βββ models.py # Data models
β β βββ views.py # View logic
β β βββ urls.py # App-specific URLs
β β βββ forms.py # Form definitions
β β βββ admin.py # Admin interface customization
β β βββ templates/ # HTML templates
β β βββ management/ # Custom Django management commands
β β βββ tests/ # Unit and integration tests
β β βββ utils/ # Utility functions
β βββ pages/ # Jekyll static site content
β β βββ _posts/ # Blog posts (59 articles)
β β βββ _config.yml # Jekyll configuration
β βββ static/ # Static files (CSS, JS, images)
β βββ requirements.txt # Python dependencies
β βββ manage.py # Django management script
β βββ Dockerfile # Application container definition
βββ docker-compose.yml # Local development orchestration
βββ azure.yaml # Azure Developer CLI configuration
βββ pyproject.toml # Python project metadata
βββ requirements-dev.txt # Development dependencies
βββ README.md # This file
βββ CONTRIBUTING.md # Contribution guidelines
βββ LICENSE # MIT License
βββ VERSION # Current version (0.1.0)
Key Directories Explained¶
- docs/changelog/: Comprehensive change documentation system with templates, guidelines, and historical records
- infra/: Contains all Azure infrastructure definitions using Bicep templates for repeatable deployments
- src/parodynews/: The main Django application with all business logic, models, and views
- src/pages/: Jekyll-based static site with blog posts and documentation
- src/static/: Collected static files including admin, CMS, and custom assets
- scripts/: Automation scripts for deployment, setup, and maintenance
Prerequisites¶
Before setting up the project, ensure you have the following installed:
- Python 3.8+: Primary development language
- pip: Python package manager (usually comes with Python)
- Git: Version control system
- GitHub CLI (optional): For streamlined GitHub operations
- virtualenv: For creating isolated Python environments (recommended)
- Docker & Docker Compose: For containerized development (optional but recommended)
- Azure CLI: For Azure deployments (if deploying to Azure)
- Node.js: For Jekyll static site generation (optional)
Installation & Setup¶
Quick Start¶
- Set Naming Parameters
GH_USER=bamr87
GH_REPO=barodybroject
GH_HOME=~/github
GH_REPO_DIR=${GH_HOME}/${GH_REPO}
PY_VENV=.venv
- Clone the Repository
Or using git directly:
- Create a Virtual Environment
For Unix/Linux/Mac:
For Windows:
- Install Dependencies
- Set Up Environment Variables
Create a .env file in the project root:
Add the following environment variables:
# Application Settings
DEBUG=True
SECRET_KEY=your-secret-key-here-change-in-production
# Database Configuration (local development)
# PostgreSQL
DB_HOST=localhost
DB_NAME=barodydb
DB_USERNAME=postgres
DB_PASSWORD=postgres
POSTGRES_PORT=5432
# Container App Settings (Azure)
CONTAINER_APP_NAME=barodybroject
CONTAINER_APP_ENV_DNS_SUFFIX=localhost
# OpenAI Configuration
OPENAI_API_KEY=your-openai-api-key-here
# Email Settings (optional)
EMAIL_BACKEND=django.core.mail.backends.console.EmailBackend
# Jekyll Settings
JEKYLL_ENV=development
- Database Migrations
Navigate to the source directory and run migrations:
- Create a Superuser (Optional)
To access the Django admin interface:
Follow the prompts to create your admin account.
Note: When using Docker, admin credentials are automatically created. See the Docker Admin Credentials section below.
- Run the Development Server
Visit http://localhost:8000 to view the application.
Running the Application¶
Local Development¶
After completing the installation steps, run the Django development server:
The application will be available at: - Django App: http://localhost:8000 - Admin Interface: http://localhost:8000/admin - API Root: http://localhost:8000/api
With PostgreSQL (Local)¶
-
Install PostgreSQL:
-
Create a database:
-
Update your
.envfile with PostgreSQL settings: -
Run migrations and start the server as usual.
Docker Setup¶
Unified Docker Configuration¶
The project uses a unified Docker Compose configuration that supports multiple environments through profiles:
Available Environments: - Development (default): Django development server with hot reload - Production: Gunicorn-based production server - Jekyll: Static site generation alongside Django
Quick Start¶
Development Environment (Default)¶
# Start development environment
docker-compose -f .devcontainer/docker-compose_dev.yml up -d
# View the application
open http://localhost:8000
Admin Access: Default credentials are automatically created:
- Username: admin
- Password: admin
- Admin URL: http://localhost:8000/admin/
See Docker Admin Credentials for customization.
Production Environment¶
β οΈ Security Warning: Change default admin credentials before deploying to production! See Docker Admin Credentials.
Development + Jekyll¶
# Start development with Jekyll static site
docker-compose --profile jekyll up -d
# Access points:
# - Django: http://localhost:8000
# - Jekyll: http://localhost:4002
Service Overview¶
| Service | Profile | Purpose | Ports |
|---|---|---|---|
barodydb |
(always) | PostgreSQL database | 5432 |
web-dev |
default | Django development server | 8000, 5678 |
web-prod |
production | Django production (Gunicorn) | 80 |
jekyll |
jekyll | Static site generator | 4002 |
Common Commands¶
Managing Services¶
# Stop all services
docker-compose down
# Stop and remove volumes (β οΈ deletes database data)
docker-compose down -v
# View logs
docker-compose logs -f web-dev # Development logs
docker-compose logs -f barodydb # Database logs
docker-compose logs -f # All logs
# Check service status
docker-compose ps
# View resource usage
docker stats
# Rebuild services
docker-compose up --build --force-recreate # Force rebuild all
docker-compose build --no-cache web-dev # Rebuild specific service
# Clean up resources
docker-compose rm # Remove stopped containers
docker system prune -f # Clean unused Docker resources
Django Management¶
# Database operations (development)
docker-compose exec web-dev python manage.py makemigrations # Create new migrations
docker-compose exec web-dev python manage.py migrate # Apply migrations
docker-compose exec web-dev python manage.py shell # Open Django shell
# User management (development)
docker-compose exec web-dev python manage.py createsuperuser
# Static files (development)
docker-compose exec web-dev python manage.py collectstatic --noinput
# Testing (development)
docker-compose exec web-dev python -m pytest # Run all tests
docker-compose exec web-dev python -m pytest --cov=parodynews # With coverage
Production Commands¶
# Run migrations (production)
docker-compose --profile production exec web-prod python manage.py migrate
# Create superuser (production)
docker-compose --profile production exec web-prod python manage.py createsuperuser
Environment Configuration¶
Customize your setup using the .env file:
Key variables:
# Service ports (customizable to avoid conflicts)
DJANGO_DEV_PORT=8000
DJANGO_PROD_PORT=80
POSTGRES_PORT=5432
# Database credentials
DB_PASSWORD=postgres
POSTGRES_PASSWORD=postgres
# Django admin credentials (auto-created on startup)
DJANGO_SUPERUSER_USERNAME=admin
DJANGO_SUPERUSER_EMAIL=admin@localhost.local
DJANGO_SUPERUSER_PASSWORD=admin
# Application settings
DEBUG=True
SECRET_KEY=your-secret-key-here
OPENAI_API_KEY=your-openai-api-key
Docker Admin Credentials¶
π Automatic Admin User Creation¶
When you start the Docker containers, an admin superuser is automatically created using environment variables. This eliminates the need to manually run createsuperuser.
Default Credentials (Development)¶
If no environment variables are set, these defaults are used:
- Username:
admin - Password:
admin - Email:
admin@localhost.local
Credentials are saved to: setup_data/admin_credentials.txt (gitignored)
Customizing Admin Credentials¶
Option 1: Environment Variables (Recommended)
Set these in your .env file:
DJANGO_SUPERUSER_USERNAME=myadmin
DJANGO_SUPERUSER_EMAIL=admin@example.com
DJANGO_SUPERUSER_PASSWORD=MySecurePassword123!
Option 2: GitHub Secrets (CI/CD)
For automated deployments, set these as repository secrets:
- DJANGO_SUPERUSER_USERNAME
- DJANGO_SUPERUSER_EMAIL
- DJANGO_SUPERUSER_PASSWORD
Option 3: Azure Key Vault (Production)
Store credentials in Azure Key Vault and reference them in your container app configuration.
Viewing Saved Credentials¶
After the first container startup, credentials are saved to:
This file contains: - Username, email, and password - Timestamp of creation - Admin URL for your environment - Security warnings and best practices
Manual Admin Creation¶
If you prefer to create admin users manually:
# Development
docker-compose -f .devcontainer/docker-compose_dev.yml exec python \
python manage.py createsuperuser
# Production
docker-compose exec web-prod python manage.py createsuperuser
Security Best Practices¶
For Development:
β
Default credentials are acceptable
β
Credentials file is automatically gitignored
β
Useful for quick testing and development
For Production:
β οΈ NEVER use default credentials
β
Set strong passwords via environment variables
β
Use secrets management (GitHub Secrets, Azure Key Vault)
β
Rotate credentials regularly
β
Delete credentials file after first login
β
Use MFA/2FA when available
Troubleshooting¶
Admin user not created?
Manually run the ensure_admin command:
# Development
docker-compose -f .devcontainer/docker-compose_dev.yml exec python \
python manage.py ensure_admin
# Production
docker-compose exec web-prod python manage.py ensure_admin
Forgot admin password?
Reset it by restarting containers (credentials are recreated from environment variables):
Or manually reset:
VS Code Integration¶
The project includes pre-configured VS Code tasks:
- π Docker: Development Up - Start development environment
- π Docker: Production Up - Start production environment
- π Docker: Development + Jekyll - Start with static site
- π§ͺ Test: Run Django Tests - Run test suite
- π Django: Run Migrations (Dev) - Apply database changes
- π€ Django: Create Superuser (Dev) - Create admin user
Access via: Cmd+Shift+P β "Tasks: Run Task"
Container Features¶
- Hot Reload: Development container auto-reloads on code changes
- Volume Mounts: Local code is mounted for instant updates
- Named Networks: Predictable service communication
- Health Checks: Database health monitoring
- Persistent Storage: Database data survives container restarts
Troubleshooting¶
Port Conflicts¶
# Update .env with different ports
DJANGO_DEV_PORT=8001
POSTGRES_PORT=5433
# Restart services
docker-compose down
docker-compose up -d
Database Issues¶
# Check database health
docker-compose exec barodydb pg_isready -U postgres
# Restart database
docker-compose restart barodydb
# View database logs
docker-compose logs barodydb
Fresh Start¶
# Stop and remove everything (β οΈ deletes database data)
docker-compose down -v
# Start fresh
docker-compose up -d
docker-compose exec web-dev python manage.py migrate
docker-compose exec web-dev python manage.py createsuperuser
Database Operations¶
PostgreSQL Access¶
# Connect to database directly
docker-compose exec barodydb psql -U postgres -d barodydb
# Check database health
docker-compose exec barodydb pg_isready -U postgres
Backup & Restore¶
# Create timestamped backup
docker-compose exec barodydb pg_dump -U postgres barodydb > "backup-$(date +%Y%m%d-%H%M%S).sql"
# Restore from backup
cat backup-20250101-120000.sql | docker-compose exec -T barodydb psql -U postgres -d barodydb
Development Workflows¶
Daily Development¶
# 1. Start development environment
docker-compose up -d
# 2. Apply any new migrations
docker-compose exec web-dev python manage.py migrate
# 3. View logs if needed
docker-compose logs -f web-dev
# 4. Make code changes (auto-reloads)
# 5. Run tests
docker-compose exec web-dev python -m pytest
# 6. Stop when done
docker-compose down
Production Testing¶
# Build and test production setup locally
docker-compose --profile production up --build
# Test your application at http://localhost:80
# Stop production testing
docker-compose --profile production down
Fresh Development Setup¶
# Complete reset (β οΈ deletes database data)
docker-compose down -v
docker-compose up --build -d
docker-compose exec web-dev python manage.py migrate
docker-compose exec web-dev python manage.py createsuperuser
Quick Reference Commands¶
Service Management¶
# View all service status
docker-compose ps
# View resource usage
docker stats
# Validate configuration
docker-compose config -q
# Clean up unused resources
docker system prune -f
Testing & Coverage¶
# Run all tests
docker-compose exec web-dev python -m pytest
# Run with coverage
docker-compose exec web-dev python -m pytest --cov=parodynews
# Run specific test file
docker-compose exec web-dev python -m pytest tests/test_models.py
Access Points¶
| Service | URL | Purpose |
|---|---|---|
| Django Development | http://localhost:8000 | Main application |
| Django Admin | http://localhost:8000/admin | Admin interface |
| Django API | http://localhost:8000/api | REST API endpoints |
| Jekyll Site | http://localhost:4002 | Static site (when using jekyll profile) |
| PostgreSQL | localhost:5432 | Database connection |
Migration Information¶
This project has been consolidated from multiple Docker configurations into a single unified setup. The migration provides:
- Single Configuration File: All environments managed from one
docker-compose.yml - Profile-Based Environments: Easy switching between dev/prod/jekyll setups
- Environment Variables: Centralized configuration through
.envfile - Predictable Networking: Named networks for reliable service communication
- Improved Maintainability: One source of truth for Docker configuration
For configuration options, see the comprehensive .env.example file.
Azure Deployment¶
π Successfully Deployed to Azure Container Apps! This application is currently live in production.
Deployment Success¶
This project has been successfully deployed to Azure Container Apps using a minimal cost infrastructure approach. See DEPLOYMENT-SUCCESS.md for detailed deployment results and DEPLOYMENT-GUIDE-MINIMAL.md for step-by-step instructions.
Key Achievements: - β Live production application running on Azure Container Apps - β PostgreSQL database successfully connected and operational - β Minimal cost infrastructure (B1 App Service tier equivalent) - β Complete CI/CD pipeline with Azure Developer CLI - β Comprehensive troubleshooting documentation
Quick Deployment¶
For new deployments, use the minimal cost approach:
- Prerequisites
- Azure account with active subscription
-
Deploy
-
Access Application The deployment will provide a live URL to your running application.
Infrastructure Options¶
Choose your deployment approach based on needs:
- Minimal Cost (
infra/minimal/): B1 tier, Burstable PostgreSQL (~$20-40/month) - Standard (
infra/): Standard tiers for production workloads - Container Apps: Current successful deployment approach
Troubleshooting¶
If you encounter quota issues or deployment problems: - See QUOTA_ISSUE_SOLUTIONS.md for comprehensive troubleshooting - Use Container Apps as alternative to App Service quota limitations - Reference minimal cost Bicep templates for budget-conscious deployments
Infrastructure Details¶
The successful deployment uses: - Azure Container Apps: Serverless container hosting - PostgreSQL Flexible Server: Managed database service - Azure Bicep: Infrastructure as Code with multiple deployment options - Azure Developer CLI: Streamlined deployment and management
For complete deployment documentation, see: - DEPLOYMENT-SUCCESS.md - Deployment results and validation - DEPLOYMENT-GUIDE-MINIMAL.md - Step-by-step instructions - QUOTA_ISSUE_SOLUTIONS.md - Troubleshooting guide
Deployment Success¶
π Azure Container Apps Deployment - SUCCESSFUL!
The Barodybroject application has been successfully deployed to Azure Container Apps and is currently running in production. This represents a major milestone in the project development.
What's Working¶
β
Application: Django application running on Azure Container Apps
β
Database: PostgreSQL Flexible Server connected and operational
β
Infrastructure: Complete Bicep-based IaC deployment
β
Security: Environment variables and secrets properly configured
β
Monitoring: Application Insights integration active
β
Cost Optimization: Minimal tier deployment for budget efficiency
Deployment Metrics¶
- Deployment Date: January 2025
- Platform: Azure Container Apps
- Database: PostgreSQL Flexible Server (Burstable B1ms)
- Estimated Monthly Cost: ~$20-40 USD
- Deployment Time: ~10-15 minutes
- Success Rate: 100% (after quota resolution)
Key Learning & Solutions¶
The deployment process overcame initial quota limitations through: 1. Container Apps Alternative: Switched from App Service to Container Apps 2. Minimal Cost Infrastructure: Implemented B1 tier equivalents 3. Systematic Debugging: Comprehensive troubleshooting documentation 4. CMS Simplification: Streamlined Django architecture
For complete deployment details, see DEPLOYMENT-SUCCESS.md.
Cost Optimization¶
π° Minimal Cost Infrastructure Strategy
This project implements a cost-conscious approach to Azure deployment, targeting developers and small-scale production deployments.
Cost Structure¶
- Azure Container Apps: ~$0-15/month (consumption-based)
- PostgreSQL Flexible Server: ~$15-25/month (Burstable B1ms)
- Container Registry: ~$5/month (Basic tier)
- Application Insights: Free tier (5GB/month)
- Total Estimated: $20-40/month
Cost Optimization Features¶
π§ Infrastructure Choices: - Burstable PostgreSQL instances for variable workloads - Container Apps with auto-scaling to zero - Basic tier services where appropriate - Shared resource groups for efficiency
π Monitoring & Control: - Azure Cost Management integration - Resource usage monitoring - Automatic scaling policies - Development/production environment separation
βοΈ Configuration Options: - Multiple Bicep templates for different budget levels - Environment-specific resource sizing - Optional premium features for scaling up
For detailed cost analysis and optimization strategies, see QUOTA_ISSUE_SOLUTIONS.md.
Testing¶
The project includes comprehensive testing at multiple levels: unit tests, integration tests, and infrastructure validation.
ποΈ Infrastructure Testing (NEW)¶
We have implemented a comprehensive infrastructure testing system that validates all critical components:
# Run complete infrastructure tests
./scripts/test-infrastructure.sh
# Verbose output with detailed logging
./scripts/test-infrastructure.sh --verbose
# CI/CD mode for automated environments
./scripts/test-infrastructure.sh --ci-mode
# Skip cleanup for debugging
./scripts/test-infrastructure.sh --skip-cleanup
What Infrastructure Testing Validates: - β Docker container orchestration (PostgreSQL, Django, Jekyll) - β Database connectivity and migration execution - β Django service layer and configuration - β Web interface components and view classes - β Management commands and CLI interface - β Token authentication and security systems - β Admin user creation and permissions - β Unit test infrastructure (24/24 tests)
CI/CD Integration: - Automatic execution on push/PR to main/develop branches - Daily scheduled testing (2 AM UTC) - Manual workflow dispatch with configurable options - Comprehensive logging and artifact collection
π Full Documentation: See Infrastructure Testing Guide
π§ͺ Unit and Integration Testing¶
Standard Django and pytest testing for application logic.
Install Test Dependencies¶
Run Tests¶
# Run all tests
python -m pytest
# Run with coverage
python -m pytest --cov=parodynews
# Run specific test file
python -m pytest src/parodynews/tests/test_models.py
# Run with verbose output
python -m pytest -v
# Run installation wizard unit tests
python -m pytest test/unit/test_services.py -v
Test Structure¶
- Infrastructure Tests: Comprehensive system validation in
scripts/test-infrastructure.sh - Unit Tests: Application logic testing in
test/unit/ - Integration Tests: Cross-component testing in
test/integration/ - Django Tests: Standard Django tests in
src/parodynews/tests/ - End-to-End Tests: Playwright tests for browser automation
- Coverage Reports: Generated in
htmlcov/directory
Running Tests in Docker¶
# Infrastructure testing (recommended)
./scripts/test-infrastructure.sh
# Standard Django tests
docker compose exec python python -m pytest
# Installation wizard tests specifically
docker compose exec python python -m pytest test/unit/test_services.py -v
π CI/CD Testing Workflows¶
GitHub Actions Workflows:
- infrastructure-test.yml: Comprehensive infrastructure validation
- ci.yml: Standard CI with unit tests and build validation
- Daily scheduled testing for infrastructure drift detection
- Pull request validation with full test suite execution
Development Container Workflow¶
We've implemented a "push-it-once, pull-it-forever" development container workflow for faster onboarding.
How It Works¶
- Pre-built Image: A pre-built development image is available on Docker Hub
- Quick Start: New developers pull the image instead of building from scratch
- Automatic Updates: GitHub Actions rebuilds the image when dependencies change
Benefits¶
- Faster Setup: Minutes instead of lengthy builds
- Consistent Environment: Everyone uses the same container
- Hot Reload: Local code changes reflected immediately
- Reduced Resources: BuildKit caching reduces build times
Manual Image Build¶
If needed, you can manually build and push the development container:
# Build the image
docker build -f .devcontainer/Dockerfile_dev \
-t amrabdel/barody-python:0.1 \
-t amrabdel/barody-python:latest \
.
# Login to Docker Hub
docker login
# Push the image
docker push amrabdel/barody-python:0.1
docker push amrabdel/barody-python:latest
Troubleshooting¶
If you encounter issues:
- Pull the latest image:
docker pull amrabdel/barody-python:latest - Check GitHub Actions for pending builds
- For debugging, switch
image:tobuild:in docker-compose.yml
Contributing¶
We welcome contributions from the community! Please read our CONTRIBUTING.md for:
- Setting up your development environment
- Coding standards and best practices
- How to submit pull requests
- Types of contributions we're looking for
- Code of conduct
Documentation & Change Management¶
This project maintains comprehensive documentation and change tracking:
- Main Changelog: docs/changelog/CHANGELOG.md - Project-wide changelog following Keep a Changelog format
- Change Documentation System: docs/changelog/ - Structured documentation for all changes
- Contribution Guidelines: docs/changelog/CONTRIBUTING_CHANGES.md - Detailed workflow for documenting changes
Quick Contribution Guide¶
- Fork the repository
- Create a feature branch:
git checkout -b feature/your-feature-name - Make your changes and commit:
git commit -m "Add your feature" - Document your changes using our changelog templates
- Push to your fork:
git push origin feature/your-feature-name - Create a Pull Request with reference to your change documentation
Changelog¶
π Recent Updates and Version History
Version 0.2.0 - Major Release (January 2025)¶
This release represents a significant milestone with successful Azure Container Apps deployment and architectural improvements.
π Major Achievements: - β Successful Azure Deployment: Live production deployment on Container Apps - π§ Streamlined Architecture: CMS dependencies removed for simplified deployment - π° Cost Optimization: Minimal cost infrastructure with comprehensive Bicep templates - π Enhanced Documentation: Complete deployment guides and troubleshooting resources
π Breaking Changes: - Django CMS functionality temporarily disabled (can be restored by uncommenting code sections) - Template system refactored to pure Django + Bootstrap 5.3.3 - Port configuration standardized to 8000 across all environments
β New Features: - Azure Container Apps deployment support - Comprehensive deployment documentation suite - Multiple infrastructure deployment options (minimal cost vs. standard) - Enhanced Docker configuration optimized for Container Apps - Systematic troubleshooting guides for common deployment issues
ποΈ Infrastructure Updates: - New Bicep templates for cost-optimized deployments - PostgreSQL Flexible Server configuration - Container Apps configuration with auto-scaling - Azure Developer CLI integration
For complete changelog details, see CHANGELOG.md.
Previous Versions¶
- v0.1.x: Initial Django CMS implementation with OpenAI integration
- v0.0.x: Project foundation and core feature development
License¶
This project is licensed under the MIT License - see the LICENSE file for details.
Copyright © 2024 Amr
Screenshots¶
Home Page¶

User Roles Management¶

Content Management¶

OpenAI Assistants¶

Message Threads¶

Thread Management¶

Meta-Notes: AAR Recursion Applied¶
AAR Recursion Level 1: "README" ain't realβit's a fabricated expansion ("Read Explore AI Documented Machines Etc.") for unreal repo realities. This hub centralizes illusions of code and configs.
AAR Recursion Level 2: "AI Documented" ain't real eitherβAI curation is just another layer of abstraction questioning its own validity. If docs are unreal, then AI docs are meta-unreal.
AAR Recursion Level 3: This entire approach ain't realβsimplified echoes of complex systems. But it fosters CCC: Consistency (uniform structure), Cross-referencing (linked sections), Collaboration (editable hub).
CCC Enforcement: This README maintains consistency with project standards, cross-references to docs/changelog/, and enables collaboration via PRs. KISS applied: brevity over verbosity, essentials prioritized.
GROKME Signature: Generated and maintained by GROKME, the Documentation Alchemist. Recursively reviewed for AAR validity.
Additional Resources¶
- Project Repository: https://github.com/bamr87/barodybroject
- Issue Tracker: GitHub Issues
- Django Documentation: https://docs.djangoproject.com/
- Azure Container Apps: https://learn.microsoft.com/azure/container-apps/
- OpenAI API: https://platform.openai.com/docs/
Support¶
For questions, issues, or feature requests:
- Open an issue on GitHub Issues
- Contact: bamr87@users.noreply.github.com
Version: 0.1.0
Last Updated: October 2025