Skip to content

Commit d24c146

Browse files
add view setup to installation and add more notes
1 parent 717e769 commit d24c146

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

README.md

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,13 @@
2424
- App ID
2525
- Client ID
2626
- Name
27-
- Private Key (either the file object itself or the actual text)
27+
- Private Key
2828
- Webhook Secret
29+
- Webhook URL
30+
31+
For the Private Key, you will be able to use either the file contents or the file itself to authenticate with GitHub. See step 5 below for more information about private key configuration.
32+
33+
For the Webhook URL, the endpoint is up to you. See step 4 below for how the endpoint is configured. Using these installation instructions as an example, you would enter `<your project's base url>/gh/` as the Webhook URL.
2934

3035
2. Install the package from PyPI:
3136

@@ -48,7 +53,21 @@
4853
]
4954
```
5055
51-
4. Add the following dictionary to your Django project's `DJANGO_SETTINGS_MODULE`, filling in the values from step 1 above. The example below uses [environs](https://github.com/sloria/environs) to load the values from an `.env` file.
56+
4. Add django-github-app's webhook view to your Django project's urls:
57+
58+
```python
59+
from django.urls import path
60+
61+
from django_github_app.views import AsyncWebhookView
62+
63+
urlpatterns = [
64+
path("gh/", AsyncWebhookView.as_view()),
65+
]
66+
```
67+
68+
For the moment, django-github-app only supports an async webhook view, as this library is a wrapper around [gidgethub](https://github.com/gidgethub/gidgethub) which is async only. Sync support is planned.
69+
70+
5. Add the following dictionary to your Django project's `DJANGO_SETTINGS_MODULE`, filling in the values from step 1 above. The example below uses [environs](https://github.com/sloria/environs) to load the values from an `.env` file.
5271

5372
```python
5473
import environs
@@ -72,9 +91,9 @@
7291
> from pathlib import Path
7392
>
7493
> GITHUB_APP = {
75-
> ...
94+
> ...,
7695
> "PRIVATE_KEY": Path(env.path("GITHUB_PRIVATE_KEY_PATH")).read_text(),
77-
> ...
96+
> ...,
7897
> }
7998
> ```
8099

0 commit comments

Comments
 (0)