A simple, reusable Django app for handling and storing Slack events and slash commands.
Project description
# django-rest-slack
A simple, reusable Django app for handling and storing Slack events and slash commands.
## Requirements
- Python 3.6
- PostgreSQL
- Django 2.0+
- DRF
## Setup
- `pip install django django-rest-framework django-rest-slack psycopg2-binary`
- Include the following to your settings.py:
```
INSTALLED_APPS = [
'rest_framework',
'rest_slack',
]
```
- Include the following to your urls.py:
```
from django.conf.urls import include
from rest_slack.views import DRSEventView, DRSCommandView
api_patterns = ([
path('events/', DRSEventView.as_view()),
path('commands/', DRSCommandView.as_view()),
], 'api')
urlpatterns += [
path('api/v1/', include(api_patterns)),
]
```
- Add your environment variables:
```
export SLACK_CLIENT_ID='your-credential'
export SLACK_CLIENT_SECRET='your-credential'
export SLACK_VERIFICATION_TOKEN='your-credential'
export SLACK_BOT_USER_TOKEN='your-credential'
```
## Running with Zappa
- `pip install zappa`
- `zappa init`
- Create a Postgres DB in AWS RDS
- Update your zappa_settings.json with the `vpc_config` information:
```
"vpc_config" : {
"SubnetIds": [ "subnet-<id>","subnet-<id>" ],
"SecurityGroupIds": [ "sg-<id>" ]
}
```
- `zappa deploy <stage>`
- Update your settings.py with the hostname created in AWS
```
ALLOWED_HOSTS = ['host.name']
```
- `zappa update <stage>`
## Todo
- More detailed instructions / examples
A simple, reusable Django app for handling and storing Slack events and slash commands.
## Requirements
- Python 3.6
- PostgreSQL
- Django 2.0+
- DRF
## Setup
- `pip install django django-rest-framework django-rest-slack psycopg2-binary`
- Include the following to your settings.py:
```
INSTALLED_APPS = [
'rest_framework',
'rest_slack',
]
```
- Include the following to your urls.py:
```
from django.conf.urls import include
from rest_slack.views import DRSEventView, DRSCommandView
api_patterns = ([
path('events/', DRSEventView.as_view()),
path('commands/', DRSCommandView.as_view()),
], 'api')
urlpatterns += [
path('api/v1/', include(api_patterns)),
]
```
- Add your environment variables:
```
export SLACK_CLIENT_ID='your-credential'
export SLACK_CLIENT_SECRET='your-credential'
export SLACK_VERIFICATION_TOKEN='your-credential'
export SLACK_BOT_USER_TOKEN='your-credential'
```
## Running with Zappa
- `pip install zappa`
- `zappa init`
- Create a Postgres DB in AWS RDS
- Update your zappa_settings.json with the `vpc_config` information:
```
"vpc_config" : {
"SubnetIds": [ "subnet-<id>","subnet-<id>" ],
"SecurityGroupIds": [ "sg-<id>" ]
}
```
- `zappa deploy <stage>`
- Update your settings.py with the hostname created in AWS
```
ALLOWED_HOSTS = ['host.name']
```
- `zappa update <stage>`
## Todo
- More detailed instructions / examples
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
File details
Details for the file django_rest_slack-0.2-py3-none-any.whl
.
File metadata
- Download URL: django_rest_slack-0.2-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8456f20f681b76196ac18e3a05a62190ed7f9794ab65c780f2251e41731b0db9 |
|
MD5 | 164409385ccdfbe0adb45aa77da4340e |
|
BLAKE2b-256 | dbfb9a2e13d8a2f17eb4e7a776a7cf13d19ef6acdac617dee3a9ff4b3ecd28ef |