Unchained CLI Commands¶
The Unchained framework provides a command-line interface for various tasks like running development servers, managing database migrations, creating superusers, and more.
Command Structure¶
All commands use the unchained prefix and follow this pattern:
Many commands accept an app_path argument which specifies the location of your application in the format module:instance. If not provided, the CLI will attempt to automatically detect your app from:
UNCHAINED_APP_PATHenvironment variablepyproject.tomlfile with[tool.unchained]section- Common app patterns in the current directory
Main Commands¶
unchained start¶
Run the development server using uvicorn.
Options: - --host, -h: Host to bind the server to (default: 127.0.0.1) - --port, -p: Port to bind the server to (default: 8000) - --reload/--no-reload: Enable/disable auto-reload for development (default: enabled)
Example:
unchained collectstatic¶
Collect static files for production deployment.
unchained version¶
Show the current version of Unchained.
unchained createsuperuser¶
Create a superuser account for the admin interface.
Examples:
unchained shell¶
Start the Django shell with your application context loaded.
Database Migration Commands¶
Unchained provides a set of commands for managing database migrations under the migrations namespace.
unchained migrations create¶
Create new database migrations based on model changes.
unchained migrations apply¶
Apply migrations to sync the database with your models.
Arguments: - app_label: App label to migrate (optional, migrates all apps if not specified) - migration_name: Specific migration to apply (optional, requires app_label)
Examples:
unchained migrations apply # Apply all pending migrations
unchained migrations apply myapp # Apply migrations for 'myapp' only
unchained migrations apply myapp 0002 # Apply specific migration
unchained migrations show¶
Show the status of all database migrations.
Arguments: - app_label: App label to show migrations for (optional, shows all apps if not specified)
Examples: