Skip to main content

dj-cli-tools

dj-cli-tools Banner dj-cli-tools is a command-line utility for Django developers designed to streamline the process of creating applications and managing boilerplate code. It extends Django's built-in management commands to provide enhanced scaffolding capabilities, particularly focused on Django REST Framework (DRF) workflows.

Features

  • Enhanced start_app: Create new Django applications using custom, pre-configured templates (e.g., versioned REST API structures). Automatically registers the new app in INSTALLED_APPS in your project's settings.py.
  • create: A powerhouse command that generates a fully functional vertical slice for a new resource. One command creates:
    • Model: Custom model definition.
    • Serializer: Corresponding ModelSerializer.
    • ViewSet: ModelViewSet with standard import.
    • Factory: factory_boy factory for testing.
    • Admin: Registers the model in admin.py.
    • URLs: Registers the ViewSet in urls.py.

Installation

pip install dj-cli-tools

Or for local development:

git clone https://github.com/AbhijithKonnayil/dj-cli-tools
cd dj-cli-tools
pip install .

Usage

1. Starting a New App

Create a new app using a specific template. This command acts like startapp but better:

python manage.py start_app <app_name> --dj_template <template_name>

Example: To create a REST API app:

python manage.py start_app core_api --dj_template simple_drf

What happens?

  • The core_api directory is created with the structure defined in simple_drf.
  • The app is automatically added to INSTALLED_APPS in settings.py (e.g., 'core_api.apps.CoreApiConfig').

2. Creating a Resource (Model, API, & More)

Generate the full stack for a new domain model in an existing app.

python manage.py create <app_name> <ModelName>

Example:

python manage.py create core_api Product

What happens? This single command will:

  1. Model: Append class Product(models.Model): ... to core_api/models.py.
  2. Serializer: Create ProductSerializer in core_api/serializers.py with necessary imports.
  3. Views: Create ProductViewSet in core_api/views.py.
  4. URLs: Register ProductViewSet with a router in core_api/urls.py (e.g., router.register(r'products', ProductViewSet)).
  5. Admin: Register Product in core_api/admin.py.
  6. Factories: Create ProductFactory in core_api/factories.py.

Requirements

  • Python 3.10+
  • Django 5.2+

License

BSD-3-Clause

Release files for dj-cli-tools 0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dj-cli-tools 0.4
File Size Uploaded
dj_cli_tools-0.4.tar.gz 14.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dj-cli-tools 0.4
File Interpreter ABI Platform
dj_cli_tools-0.4-py3-none-any.whl Python 3 none any Details

Total release size: 32.3 kB

Release files / dj_cli_tools-0.4.tar.gz

Download URL dj_cli_tools-0.4.tar.gz
Size 14.7 kB
Tags Source
SHA-256 checksum
How to use checksums
d1c23b65e6e7da2538bb74e35944d09bbbed81ae1d6fa8f5d1a794a4bce96452
BLAKE2b-256 checksum
How to use checksums
8041272b608105e78c01b23cb986b178c9340dc46833289457ad7843360b7329
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.8

Release files / dj_cli_tools-0.4-py3-none-any.whl

Download URL dj_cli_tools-0.4-py3-none-any.whl
Size 17.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b9334e0102b0f69eece486db760cc299787802887e1038d5b62949c6827e48b3
BLAKE2b-256 checksum
How to use checksums
0a9c094d70315c6d3b72d5c5b323f68c9a5f66b758c6dd4ac9a18bf3cde0ecb4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.8

Release history Release notifications | RSS feed

This release

0.4 This release

2 release files

0.3

2 release files

0.2

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page