Skip to main content

CLI tools for DjangoPlay developers. A lightweight command-line interface for managing local development environments within the DjangoPlay ecosystem.

Project description

djangoplay-cli

PyPI Python License Django Lint

djangoplay-cli is a developer command-line interface for managing local development environments within the DjangoPlay ecosystem.

The CLI simplifies common developer workflows such as:

  • starting the development server
  • managing Celery workers
  • validating environment dependencies
  • resetting development services
  • streaming application logs
  • orchestrating local development processes

The goal is to provide a simple, predictable, and portable developer tool without introducing complex infrastructure dependencies.


Philosophy

This project follows several guiding principles:

  • Minimal configuration
  • No secrets in the repository
  • Clear command structure
  • Stable developer experience
  • Incremental releases
  • Developer-first ergonomics

The CLI is designed to remove repetitive setup tasks so developers can focus on application development instead of environment management.


Supported Platforms

Platform Status
macOS Supported
Linux Supported
Ubuntu Supported
Windows (WSL) Supported
Windows native Limited

Installation

Install from PyPI:

pip install djangoplay-cli

Verify installation:

dplay --version

Example output:

1.0.4

CLI Overview

The CLI is organized into command groups.

dplay
 ├── dev
 │    ├── http
 │    ├── ssl
 │    ├── certs
 │    ├── worker
 │    └── logs
 │
 ├── system
 │    ├── doctor
 │    └── reset
 │
 └── logs

Development Commands

These commands manage the Django development environment.


Start HTTP development server

dplay dev http

Performs the following steps automatically:

  • encrypts environment variables from ~/.dplay/
  • flushes Redis cache
  • collects static files
  • restarts Celery worker and beat
  • waits until Celery is ready
  • stops any existing Django server on the port
  • opens the browser
  • starts the Django HTTP development server

Server URL:

http://localhost:3333

Start HTTPS development server

dplay dev ssl

Performs the same steps as dplay dev http, plus:

  • checks for SSL certificates under ~/.dplay/ssl/
  • generates self-signed certificates if absent
  • trusts the certificate in the system keychain automatically (macOS Keychain, Linux system store, or Windows store via WSL)
  • starts the server via runserver_plus with the certificate and key

Server URL:

https://localhost:9999

If SSL certificates cannot be created, the CLI exits with: TLS certificate unavailable. Use dplay dev http


Default command

Running dplay dev without a subcommand starts the HTTP server:

dplay dev

Start Celery worker

dplay dev worker

Starts the Celery worker for the DjangoPlay application in the foreground.


Regenerate SSL certificates

dplay dev certs

Regenerates local SSL certificates from the current ~/.dplay/config.yaml. Use this after adding new subdomains to subdomains.extra_domains in config.

Automatically trusts the new certificate in the system keychain on macOS, Linux, and WSL. No server restart required.

To add subdomain coverage, update ~/.dplay/config.yaml:

subdomains:
  extra_domains:
    - issues.localhost
    - docs.localhost

Then run:

dplay dev certs
dplay dev ssl

Stream application logs

dplay dev logs
dplay dev logs [APP]

Streams and pretty-prints application logs with colorized output by log level. Defaults to django.log. Pass an app name to tail a specific log file. Available apps are discovered automatically from backend/logs/.

dplay dev logs                            # django.log, last 50 lines, follow
dplay dev logs users                      # users.log, last 50 lines, follow
dplay dev logs mailer --level ERROR       # errors only, follow
dplay dev logs django --no-follow -n 100  # last 100 lines, exit

Options:

Option Default Description
APP django App name e.g. users, mailer, frontend
--lines / -n 50 Historical lines shown on startup
--level / -l None Filter by level: DEBUG INFO WARNING ERROR CRITICAL
--follow / --no-follow follow Stream new lines in real time

Also available as dplay logs at the top level.


System Commands

System commands validate and reset the development environment.

Run environment diagnostics

dplay system doctor

Checks:

  • Python version
  • Redis availability
  • PostgreSQL availability
  • Celery installation

Example output:

Environment Diagnostics

✔ Python version OK
✔ Redis reachable
✔ Postgres reachable
✔ Celery available

Reset development environment

dplay system reset

Actions performed:

  • stop running Celery workers
  • stop Celery beat processes
  • flush Redis cache

CLI Help

Show CLI help:

dplay --help

Show development commands:

dplay dev --help

Show system commands:

dplay system --help

Project Structure

djangoplay-cli/

dplay/
  commands/
  core/
  environment/
  utils/

Architecture Layers

Layer Responsibility
CLI Commands user-facing commands
Core repository detection, process manager
Environment environment validation
Utils reusable helpers (ssl, logs, redis, static)

This modular architecture keeps the CLI maintainable as new features are added.


Development Setup

Clone repository:

git clone https://github.com/binaryfleet/djangoplay-cli.git
cd djangoplay-cli

Install in editable mode:

pip install -e .

Install development tools:

pip install ruff pytest

Run lint checks:

ruff check .

Run tests:

pytest

Security Principles

This project follows strict security practices:

  • no credentials stored in the repository
  • CLI never generates secrets automatically
  • CLI never writes credentials to disk

Versioning

This project follows Semantic Versioning.

v0.x  → experimental development
v1.x  → stable production releases

License

This project is licensed under the MIT License.

See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

djangoplay_cli-1.0.4.tar.gz (18.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

djangoplay_cli-1.0.4-py3-none-any.whl (26.3 kB view details)

Uploaded Python 3

File details

Details for the file djangoplay_cli-1.0.4.tar.gz.

File metadata

  • Download URL: djangoplay_cli-1.0.4.tar.gz
  • Upload date:
  • Size: 18.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for djangoplay_cli-1.0.4.tar.gz
Algorithm Hash digest
SHA256 06f6338f690f4ec00a2765fc7653272c18fae5165e748ad42064f21acf5f9ee7
MD5 f2a09a3d376e8b9fd2207b76654e9130
BLAKE2b-256 4be90b5c85ba075f45dc71996c742ef7678b54272939984f8ac8199f2d6fb39a

See more details on using hashes here.

File details

Details for the file djangoplay_cli-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: djangoplay_cli-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 26.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for djangoplay_cli-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 112b815a57bf27906cec676b5ac1eb876fbd79cc373a97dcaa53803052c0e942
MD5 b311d226e5731b27591bb753beae711e
BLAKE2b-256 705eacb79e12726f58daf5eb041a1ffc6774a0101771ea7bc81dac74da2af844

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page