Skip to main content

Simple django application to trigger hooked methods.

Project description

hooked-on-django

Version

startup hook

All methods listed under this hook will be executed after Django finishes its startup process.

settings.py

INSTALLED_APPS = [
    ...,
    "hooks.startup",
    ...,
]

DJANGO_HOOKS = {
    "STARTUP": {
        "path.to.method": {
            "delay": 0,
            "args" : [
                ...
            ],
            "kwargs": {
                ...
            },
        }
    }
}
examples
file: /path/to.py

def method(param1: str, param2: int):
    ...

def other(param1: str = "", param2: int = 0):
    ...

def another():
    ... 

To add a hook to each of these methods, the following configuration can be used:

DJANGO_HOOKS = {
    "STARTUP": {
        "path.to.method": {
            "delay": 10,
            "args": ["string", 123456]
        },
        "path.to.other": {
            "kwargs": {
                "param1": "string", 
                "param2": 123456
            }
        },
        "path.to.other": {},  # No params needed.
    }
}

note: additionaly, the method method will be executed after a 10 seconds delay.

🎣️

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

hooked-on-django-0.2.0.tar.gz (3.2 kB view hashes)

Uploaded Source

Built Distribution

hooked_on_django-0.2.0-py3-none-any.whl (3.6 kB view hashes)

Uploaded Python 3

Supported by

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