Skip to main content
PyPI version Code Health Python versions Django versions License

Django Scripts Tracker

An unofficial Django utility tool that tracks management scripts execution.

What does it mean “to track script execution”?

Scripts tracker watches manage.py scripts located in your_app/management/commands directory and just after you pull some new code and apply its migrations - you will get notified about new (or modified) manage.py scripts that should be applied for the project to work properly.

Home page: https://krzysiek555.github.io/django-scripts-tracker

Quick feature preview

Step 1 - decorate your management script handle() method with @tracked_script decorator and push it to repository:

class Command(BaseCommand):
    help = 'Some sample script help text'

    @tracked_script
    def handle(self, *args, **options):
        # (...)

Step 2 - anyone who pulls your changes and runs migrations, will get a notification message:

$ python manage.py migrate
(...)
Running migrations:
  (...)
Checking management scripts:
  You have 1 new and 0 modified management scripts to be applied.
New scripts (1):
  your_app/management/commands/sample_management_script.py
    Some sample script help text

Installation

  1. Install the app using pip package manager:

    pip install django-scripts-tracker
  2. Add django_scripts_tracker to your INSTALLED_APPS setting:

    # your_app/settings.py
    INSTALLED_APPS = [
        # (...)
        'django_scripts_tracker',
    ]
  3. Run migrations in order to create tracker models:

    python manage.py migrate
  4. Configure directories that should be scanned for management scripts:

    # your_app/settings.py
    COMMANDS_DIRS = [
        'your_app/management/commands',
        'another_app/management/commands',
    ]

Usage

How to add a new tracked script?

  1. Create a new management script under a tracked (...)/management/commands/ directory (tracked directories are defined in COMMANDS_DIRS).

  2. Decorate either handle() or handle_noargs() Command method with a @tracked_script decorator.

  3. Make sure that the created script file is not ingored and is within a tracked directory.

How to check if there are unapplied scripts?

Script checking process takes place every time you perform DB migrations, but you can also invoke it manually:

python manage.py check_scripts

How to mark scripts as “applied” ones?

Scripts are automatically marked as applied ones just after their execution.

If there are some scripts that have already been applied but the tracker lists them - it is possible to mark them manually as applied ones.

To mark scripts as “applied” ones type in the following command:

python manage.py check_scripts --mark-all-applied

Read more

For more information visit home page:

https://krzysiek555.github.io/django-scripts-tracker

Metadata

Release files for django-scripts-tracker 0.2

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

Source distribution (sdist)

Source distribution for django-scripts-tracker 0.2
File Size Uploaded
django-scripts-tracker-0.2.tar.gz 11.4 kB Details

Release files / django-scripts-tracker-0.2.tar.gz

Download URL django-scripts-tracker-0.2.tar.gz
Size 11.4 kB
Tags Source
SHA-256 checksum
How to use checksums
576e1c6f8730c278ac2b6cce9a25e92e7ee5d7c3104abc6eee45f2b9fc34b1ef
BLAKE2b-256 checksum
How to use checksums
9ae37ecdafe09bc770698cde84da6b518d9761bbe4603fee237adf500aa7b7e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.2 This release

1 release file

0.1

1 release file

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