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.1.0.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

hooked_on_django-0.1.0-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

Details for the file hooked-on-django-0.1.0.tar.gz.

File metadata

  • Download URL: hooked-on-django-0.1.0.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.8.0

File hashes

Hashes for hooked-on-django-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c2b2452d3fa529d14430e5efc4574d136d5478956bc0eca0b0f3d6f4f6fcfadf
MD5 03d4871a06fb485c6b8c2024e3ae9e6b
BLAKE2b-256 4cce6fe4dda9eb2df642365c92843fb3723fd4b955606176758d8b660d3c8366

See more details on using hashes here.

File details

Details for the file hooked_on_django-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: hooked_on_django-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.8.0

File hashes

Hashes for hooked_on_django-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 22cba5a891c9410e32166a82637c193059cf7aceeab3e9ffbc1f0ca39d8b9f8e
MD5 d169953714e7cca9030e6703bfbdf997
BLAKE2b-256 47c5c21633b8a89108e5f5372e8ad8168201fbea850ab301b8e8f025add944d4

See more details on using hashes here.

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