Wagtail Subscriptions
Getting Started:
Installation Guide
Requirements
Installation
1. Install Package
2. Add to INSTALLED_APPS
3. Configure Settings
4. Add URLs
5. Run Migrations
6. Set Up Permissions
7. Create Superuser (if needed)
Verification
Next Steps
Quick Start Guide
Step 1: Create Your First Module
Step 2: Create Features
Basic Feature
Quota Feature
Step 3: Create Subscription Plans
Free Plan
Pro Plan
Step 4: Associate Features with Plans
Free Plan Features
Pro Plan Features
Step 5: Configure Payment Processor
Step 6: Add Pricing to Your Site
Step 7: Test the Flow
Protecting Content
In Views
In Templates
What’s Next?
Troubleshooting
Common Issues
Core Concepts:
Architecture Overview
System Design
Core Components
1. Models Layer
2. Payment Processor Layer
3. Permission System
4. Services Layer
5. Admin Interface
Data Flow
Subscription Creation Flow
Feature Access Check Flow
Webhook Processing Flow
Database Schema
Key Relationships
Indexes
Extension Points
Custom Payment Processors
Custom Notification Handlers
Custom Analytics
Security Considerations
Webhook Signature Verification
Permission Checks
Audit Logging
Performance Optimization
Query Optimization
Caching Strategy
Background Tasks
Testing Strategy
Unit Tests
Integration Tests
End-to-End Tests
Deployment Considerations
Environment Variables
Database Migrations
Static Files
Monitoring
API Reference
Models API
SubscriptionPlan
Fields
Methods
Example Usage
Subscription
Fields
Properties
Methods
Example Usage
Feature
Fields
Methods
Payment Processors API
BasePaymentProcessor
Abstract Methods
Example: Custom Processor
StripePaymentProcessor
Configuration
Additional Methods
Permission System API
Decorators
subscription_required
feature_required
View Mixins
SubscriptionRequiredMixin
FeatureRequiredMixin
Template Tags
has_feature
subscription_info
price_table
Services API
InvoiceService
Methods
Example Usage
NotificationService
Methods
Utility Functions
Registry Functions
Analytics Functions
Signals
Available Signals
Management Commands
setup_subscription_permissions
subscription_maintenance
sync_tenant_plans
Integration Guides:
Payment Integration Guide
Overview
Supported Processors
Stripe Integration
Setup
Webhook Configuration
Usage Example
Stripe-Specific Features
Payment Intents
Payment Methods
Proration
Paddle Integration
Setup
Webhook Configuration
Usage Example
PayPal Integration
Setup
Webhook Configuration
Usage Example
Custom Payment Processor
Implementation
Registration
Configuration
Webhook View
Testing Payment Integration
Stripe Test Mode
Paddle Sandbox
PayPal Sandbox
Unit Tests
Best Practices
Error Handling
Idempotency
Webhook Security
Monitoring
Multi-Tenant Setup Guide
Overview
Architecture
Single-Tenant Mode (Default)
Multi-Tenant Mode
Setup with django-tenant-schemas
1. Install Dependencies
2. Configure Django Settings
3. Create Tenant Model
4. Run Migrations
5. Create Subscription Plans (Public Schema)
Usage in Multi-Tenant Mode
Creating Tenant with Subscription
Checking Feature Access
Template Usage
Programmatic Access
Tenant Provisioning Workflow
Complete Tenant Setup
Tenant-Aware Admin
Custom Admin Views
Wagtail Admin Integration
Subscription Management
Upgrade/Downgrade Tenant Plan
Cancel Tenant Subscription
Billing Portal
Tenant Billing View
Webhooks in Multi-Tenant
Handling Tenant Webhooks
Testing Multi-Tenant Setup
Test Case Example
Best Practices
1. Tenant Isolation
2. Subscription Management
3. Feature Access
4. Billing
5. Monitoring
Troubleshooting
Common Issues
Deployment Guide
Production Deployment
Prerequisites
Environment Setup
1. Install System Dependencies
2. Create Virtual Environment
3. Install Package
Django Configuration
settings/production.py
Environment Variables
Database Setup
Gunicorn Configuration
Nginx Configuration
SSL Certificate (Let’s Encrypt)
Celery Setup (Optional)
celery.service
celerybeat.service
Docker Deployment
Dockerfile
docker-compose.yml
Monitoring
Health Check Endpoint
Monitoring Tools
Backup Strategy
Database Backup
Media Files Backup
Scaling
Horizontal Scaling
Database Optimization
Caching Strategy
Security Checklist
Development:
Contributing to Wagtail Subscriptions
Development Setup
Code Style
Testing
Pull Request Process
Reporting Issues
Documentation
Release Process
Testing Wagtail Subscriptions Package
Method 1: Using the Example Project (Recommended)
1. Set up the example project:
2. Run migrations and create superuser:
3. Start the development server:
4. Test the package:
Method 2: Install in Development Mode
1. In your existing Django/Wagtail project:
2. Add to your settings.py:
3. Add URLs:
4. Run migrations:
Method 3: Using pip install from local directory
1. Install directly from the package directory:
2. Or with extras:
Method 4: Using Docker (for isolated testing)
1. Create a Dockerfile in the example_project:
2. Build and run:
Testing Checklist
Basic Functionality:
Subscription Features:
Payment Integration:
Advanced Features:
Quick Test Script
Troubleshooting
Common Issues:
Debug Mode:
Running Tests
Unit Tests:
With Coverage:
Integration Tests:
Wagtail Subscriptions
Index
Index