Small Django APP for managing Bitbucket or Github webhooks
Tested on Python 2.7 and 3.4, with Django 1.7, 1.8, 1.9, 1.10 and 1.11. The minimum version of Django that covers this APP is 1.7, there began the maintenance of JsonResponse
Note: You can use python 3.5. It not only works for Django 1.7
pip install django-bitbucket-hook
- Add
django_bitbucket_hook
toINSTALLED_APPS
in yoursettings.py
- Run
./manage.py migrate
- Add
url(r'^hook/', include('django_bitbucket_hook.urls'))
- In the admin panel you will find fields for Hook
- Fields
- Name - The name of the hook
- User - User created repository ( Example: https://github.com/Kras4ooo/django-bitbucket-hook/ ->
Kras4ooo
) - Repo - The name of the repo ( Example: https://github.com/Kras4ooo/django-bitbucket-hook/ ->
django-bitbucket-hook
) - Path - Full path to the script to be executed ( Example:
/home/test/test-repo/execute-script.sh
) - Branch - Which branch to be monitored ( Example:
dev
,master
,test
,stage
...etc )
- Go to set up your Webhook
- If everything is okay you will get the following response in Webhook (
{'success': True}
) - Examples URLS
- http[s]://domain/hook -> Gets the Hook that corresponds to the user name, and repo name
- http[s]://domain/hook/name -> Gets the hook that fits the following name
- http[s]://domain/hook/name/branch -> Gets the Hook which has the same name and branch of the repository