forked from chiefonboarding/ChiefOnboarding
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathurls.py
34 lines (24 loc) · 807 Bytes
/
urls.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import logging
from django.conf import settings
from django.http import HttpRequest
from django.urls import path
from django.views.decorators.csrf import csrf_exempt
logger = logging.getLogger(__name__)
@csrf_exempt
def slack_events_handler(request: HttpRequest):
return handler.handle(request)
app_name = "slack"
urlpatterns = []
if not settings.SLACK_USE_SOCKET:
from slack_bolt.adapter.django import SlackRequestHandler
try:
from .views import app
handler = SlackRequestHandler(app=app)
urlpatterns = [
path("bot", slack_events_handler, name="slack_events"),
]
except Exception as e:
logger.error("Couldn't start slack app: " + str(e))
elif settings.SLACK_APP_TOKEN != "":
# Start websocket app
from .views import app