Django Multi-Platform Scraper Management CLI (dj.sh)
A comprehensive command-line interface for managing your Django multi-platform scraper application with integrated development environment management, testing, and database operations.Table of Contents
- Quick Start
- Basic Django Commands
- Development Environment Management
- Platform & Application Management
- Testing & Validation
- Database Management
- Development Workflows
- API Testing
- Common Use Cases
- Troubleshooting
Quick Start
Basic Django Commands
Standard Django management commands for development operations.run - Start Development Server
Starts the Django development server.
| Option | Description | Example |
|---|---|---|
--port | Specify port number | ./dj.sh run --port 8080 |
--host | Specify host address | ./dj.sh run --host 0.0.0.0 |
- Daily development server startup
- Testing with different ports
- Making server accessible to network
mkmig - Create Migrations
Creates Django database migrations for model changes.
| Parameter | Required | Description | Example |
|---|---|---|---|
app_name | No | Specific app to migrate | ./dj.sh mkmig scraper |
- After modifying Django models
- Creating initial migrations for new apps
- Preparing database schema changes
mig - Apply Migrations
Applies pending database migrations.
| Parameter | Required | Description | Example |
|---|---|---|---|
app_name | No | Specific app to migrate | ./dj.sh mig scraper |
migration_name | No | Specific migration to apply | ./dj.sh mig scraper 0001 |
- Initial database setup
- Applying schema changes
- Updating database structure
sudo - Create Superuser
Creates a Django superuser account for admin access.
- Username
- Email address
- Password (entered twice)
- Initial admin account creation
- Creating additional admin users
- Accessing Django admin interface
shell - Django Shell
Opens an interactive Django shell with project context loaded.
- Interactive model testing
- Data manipulation
- Debugging database queries
- Testing Django functionality
check - System Check
Runs Django’s system check framework to identify potential issues.
- Pre-deployment validation
- Identifying configuration issues
- Checking for deprecated code
test - Run Tests
Executes Django test suite.
| Parameter | Required | Description | Example |
|---|---|---|---|
app_name | No | Specific app to test | ./dj.sh test scraper |
test_class | No | Specific test class | ./dj.sh test scraper.TestModels |
test_method | No | Specific test method | ./dj.sh test scraper.TestModels.test_application |
- Running full test suite
- Testing specific functionality
- Continuous integration validation
Development Environment Management
Commands for setting up, managing, and maintaining development environments with multi-platform scraper data.devstart / setup - Setup Development Environment
Creates a complete development environment with test data, users, and platform configurations.
| Option | Default | Description | Example |
|---|---|---|---|
--tier | pro | Subscription tier | ./dj.sh devstart --tier enterprise |
--username | devuser | Username to create | ./dj.sh devstart --username testdev |
--email | {username}@example.com | User email | ./dj.sh devstart --email dev@company.com |
--password | devpassword123 | User password | ./dj.sh devstart --password mypass |
--notion-token | ENV var | Notion API token | ./dj.sh devstart --notion-token secret_xxx |
--feature-db-id | ENV var | Features database ID | ./dj.sh devstart --feature-db-id abc123 |
--skip-existing | No | Skip if user exists | ./dj.sh devstart --skip-existing |
NOTION_TOKEN- Notion API tokenFEATURE_DB_ID- Notion features database IDTIER_DB_ID- Notion tiers database IDIO_DB_ID- Notion I/O database IDTAG_DB_ID- Notion tags database IDKEYWORD_DB_ID- Notion keywords database ID
- User account with specified tier subscription
- Platform (Notion workspace) configuration
- Two sample applications (Skyflow, Nexus)
- Data source connections
- Platform access permissions
- Initial development setup
- Creating test environments
- Onboarding new developers
devstart_full - Full Development Setup
Sets up a comprehensive PRO-tier development environment with all features enabled.
- Complete feature testing
- Demo environments
- Full integration testing
devstart_minimal - Minimal Development Setup
Creates a basic FREE-tier environment for testing limitations and basic functionality.
- Testing tier limitations
- Basic functionality verification
- Minimal resource usage
devclear / clear - Clear Development Data
Removes all development data including users, applications, platforms, and related records.
| Option | Description | Example |
|---|---|---|
--all-users | Clear all test users | ./dj.sh devclear --all-users |
--username | Clear specific user | ./dj.sh devclear --username testuser |
--keep-user | Keep user but clear data | ./dj.sh devclear --keep-user |
--clear-cache | Also clear cache/logs | ./dj.sh devclear --clear-cache |
- Applications and data sources
- Platform access permissions
- User subscriptions
- Cache entries (if specified)
- API logs (if specified)
- Clean slate development
- Removing test data
- Preparing for fresh setup
dryclear / preview - Preview Cleanup
Shows what data would be deleted without actually performing the deletion.
- Users and their applications
- Platform connections
- Subscription details
- Data source counts
- Verifying cleanup scope
- Understanding data relationships
- Safe exploration of cleanup impact
devclear_user - Clear Specific User
Removes data for a specific user only.
| Parameter | Required | Description | Example |
|---|---|---|---|
username | Yes | Username to clear | ./dj.sh devclear_user testuser |
- Removing specific test users
- Targeted data cleanup
- User account management
devstatus / status - Development Status
Shows comprehensive development environment status with detailed information.
| Option | Description | Example |
|---|---|---|
--username | Check specific user | ./dj.sh devstatus --username testuser |
--detailed | Show detailed info | ./dj.sh devstatus --detailed |
- User accounts and permissions
- Subscription tiers and usage
- Applications and data sources
- Platform connections
- Global system statistics
- Environment health checks
- Understanding current setup
- Debugging configuration issues
devstatus_quick - Quick Status Check
Shows condensed status information for rapid assessment.
- Quick health checks
- Daily status verification
- Rapid troubleshooting
Platform & Application Management
Commands for inspecting and managing the multi-platform architecture components.apps - List Applications
Displays all applications organized by user with data source information.
- Understanding application structure
- Verifying data source connections
- Application inventory
platforms - List Platforms
Shows all platforms with their datasets and connected applications.
- Platform inventory
- Dataset usage analysis
- Connection relationship mapping
users - List Users with Details
Comprehensive user listing with subscription and application information.
- Username
- Subscription tier
- Request usage (used/limit)
- Application count
- Staff status
- Active status
- User management
- Subscription monitoring
- Access level verification
Testing & Validation
Comprehensive testing commands for validating system functionality and integration.test_integration - Comprehensive Integration Test
Runs the complete integration test suite with detailed reporting.
| Option | Description | Example |
|---|---|---|
--verbose | Detailed output | ./dj.sh test_integration --verbose |
--skip-api | Skip API tests | ./dj.sh test_integration --skip-api |
- Data structure validation
- Registry integration
- Application data access
- Filtering system functionality
- Data source connections
- API endpoint testing
- Backward compatibility
- Error handling
- Pre-deployment validation
- Feature development verification
- System health assessment
test_quick - Quick Integration Test
Runs essential integration tests with minimal output.
- Rapid functionality check
- Daily development validation
- Quick smoke testing
validate - Validate Setup
Performs comprehensive validation of development environment setup.
- User accounts and subscriptions
- Platform configurations
- Application and data source connections
- Registry functionality
- Database consistency
- Post-setup verification
- Troubleshooting configuration issues
- Environment health assessment
test_auth - Test Authentication
Validates authentication system functionality with test requests.
- User login capability
- Session management
- API request authentication
- Permission verification
- Authentication troubleshooting
- Permission verification
- API access testing
api_test - Test API Endpoints
Comprehensive testing of all API endpoints with authentication.
/scrape/apps/- Applications list/scrape/platforms/- Platforms list/scrape/features/- Features data/scrape/tiers/- Tiers data
- API functionality verification
- Endpoint availability checking
- Integration testing
Database Management
Commands for database operations, backup, and maintenance.reset_db - Reset Database
Completely resets the database by deleting and recreating it.
- Interactive confirmation required
- Complete data loss warning
- Suggests follow-up commands
- Prompts for confirmation
- Deletes database file
- Runs migrations to recreate schema
- Suggests running
devstartfor test data
- Complete environment reset
- Resolving migration conflicts
- Starting with clean database
backup - Backup Database
Creates a timestamped JSON backup of the entire database.
- Location:
/tmp/db_backup_YYYYMMDD_HHMMSS.json - Format: Django fixtures JSON
- Includes all data and relationships
- Pre-deployment backups
- Development snapshots
- Data preservation before major changes
restore - Restore Database
Restores database from a backup file.
| Parameter | Required | Description | Example |
|---|---|---|---|
backup_file | Yes | Path to backup file | ./dj.sh restore /tmp/db_backup_20250909_143052.json |
- Lists available backups if no file specified
- Interactive confirmation for data overwrite
- Validates backup file exists
- Disaster recovery
- Rolling back changes
- Environment restoration
Development Workflows
High-level workflow commands that combine multiple operations for common development scenarios.dev_reset - Complete Development Reset
Performs a complete reset and fresh setup of the development environment.
- Clear existing data (all users, platforms, applications)
- Set up fresh PRO environment with
devuser - Validate setup completeness
- Run integration tests
- Report completion status
- Major environment corruption
- Starting fresh development cycle
- Resolving complex configuration issues
dev_check - Development Environment Check
Quick comprehensive health check of the development environment.
- Detailed status report
- Setup validation
- Authentication test
- Daily environment verification
- Quick troubleshooting
- Development readiness check
Tier-Specific Setup Commands
Commands for creating users with specific subscription tiers for testing different feature sets.setup_free - FREE Tier Setup
- User:
freeuser - Tier: FREE (1,000 requests/month)
- Limitations: 1 platform, 1 dataset, no analytics/export
setup_basic - BASIC Tier Setup
- User:
basicuser - Tier: BASIC (10,000 requests/month)
- Features: 2 platforms, 3 datasets, analytics enabled
setup_pro - PRO Tier Setup
- User:
prouser - Tier: PRO (50,000 requests/month)
- Features: 5 platforms, 10 datasets, all features enabled
setup_enterprise - ENTERPRISE Tier Setup
- User:
enterpriseuser - Tier: ENTERPRISE (200,000 requests/month)
- Features: Unlimited platforms/datasets, all features
- Feature limitation verification
- Subscription upgrade testing
- User experience validation across tiers
API Testing
Dedicated commands for testing API functionality and endpoints.api_test - Comprehensive API Testing
Tests all major API endpoints with proper authentication.
- Authentication verification
- Endpoint availability
- Response format validation
- Error handling
- Applications management
- Platform information
- Legacy compatibility endpoints
- Data retrieval endpoints
- API functionality verification
- Integration testing
- Deployment validation
Common Use Cases
First Time Project Setup
Daily Development Workflow
Testing Different Subscription Tiers
Preparing for Deployment
Development Environment Maintenance
Troubleshooting
Common Issues and Solutions
No Applications Showing
Problem:./dj.sh apps shows no applications
Solutions:
Authentication Failures
Problem: API endpoints return authentication errors Solutions:Database Migration Issues
Problem: Migration errors or conflicts Solutions:Environment Corruption
Problem: Multiple issues or inconsistent state Solutions:Diagnostic Commands
Getting Help
Best Practices
- Always backup before major changes: Use
./dj.sh backup - Use dry-run commands: Preview changes with
./dj.sh dryclear - Regular validation: Run
./dj.sh validateafter setup changes - Test different tiers: Use tier-specific setup commands for comprehensive testing
- Clean environment: Use
./dj.sh dev_resetfor fresh starts - Monitor status: Regular
./dj.sh devstatuschecks for environment health