Skip to main content

Plugin interface to list and execute existing management commands.

Project description

    # Django Commands UI

This project offers a solution to list and execute all existing management commands in your Django project.

Configuration

To install and configure it these steps should be followed:

  1. Install the dependency from PyPi.

    pip install django-commands-ui
    
  2. Add commands_ui as an installed app in your Django project.

  3. Add these needed settings:

     # Celery app name
     COMMANDS_UI_CELERY_APP = ""
    
     # Working celery queue name for delayed jobs.
     COMMANDS_UI_DELAYED_JOBS_QUEUE = ""
    
     # Working celery queue name for standard jobs.
     COMMANDS_UI_JOBS_QUEUE = ""
    
     # List of apps from we want to extract the runnable commands.
     COMMANDS_UI_JOB_APPS = ""
    
     # Primary database identifyer, not the replica one.
     DATABASE_PRIMARY = getattr(settings, "DATABASE_PRIMARY", "default")
    
     # Define if the current environment is a cron environment.
     CRON_ENVIRONMENT = getattr(settings, "CRON_ENVIRONMENT", False)
    
  4. Include package URLs to your base urls file like this:

    path("jobs/", include("commands_ui.urls")),
    
  5. Create tables:

    python manage.py migrate commands_ui
    

It is recommended to override base.html so the appearance is customizable, as all django-commands-ui templates extend from it.

Documentation

Implementing a management command job

The only needed thing for implementing a working management command job in django-commands-ui is extending the existing JobBasedCommand. This class adds some default arguments (such as --job-id).

Example on how to use this class:

from commands_ui import management_commands
from django.core.management.base import CommandParser

# Extend the JobBasedCommand class
class Command(management_commands.JobBasedCommand):
   def handle(self, *args: Any, **options: Any) -> None:
      # Any time `self.print` is used, the message will be added to both standard output and
      # Job output.
      self.print("Starting")
      for i in range(0, 20):
         self.print(i)
      self.print("Finishing")

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

django-commands-ui-0.0.1.tar.gz (22.1 kB view details)

Uploaded Source

Built Distribution

django_commands_ui-0.0.1-py3-none-any.whl (27.4 kB view details)

Uploaded Python 3

File details

Details for the file django-commands-ui-0.0.1.tar.gz.

File metadata

  • Download URL: django-commands-ui-0.0.1.tar.gz
  • Upload date:
  • Size: 22.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.2

File hashes

Hashes for django-commands-ui-0.0.1.tar.gz
Algorithm Hash digest
SHA256 215a63c9f507604d4af24f4fa61f77accc755962c8ee452759d3b659b7824b49
MD5 1076c55e7551fd4cd6212245fe974aab
BLAKE2b-256 c45a7356cec32951108668dc7921e2775f18e7726d90a58797407b4d16a1a7b6

See more details on using hashes here.

File details

Details for the file django_commands_ui-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for django_commands_ui-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8fc016845fc1048995b916d9babe637df0f7fa1eb3a7b0b190caabc7a5c87655
MD5 6d272f0fac4240267e4f98da21920b22
BLAKE2b-256 7fef75ea77528d4f53852e040660592eb740545fbc0a29e0a91548673f7e8115

See more details on using hashes here.

Supported by

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