routing.py 725 Bytes
Newer Older
Eliot Berriot's avatar
Eliot Berriot committed
1
2
3
4
5
6
7
8
9
10
import os
import sys

app_path = os.path.abspath(
    os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir)
)
sys.path.append(os.path.join(app_path, "retribute_api"))
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.base")


11
12
from django.conf.urls import url

Eliot Berriot's avatar
Eliot Berriot committed
13
from channels.routing import ProtocolTypeRouter, URLRouter, AsgiHandler
14
15
16
17
18
19
20
21
22
23

from retribute_api.search import consumers

application = ProtocolTypeRouter(
    {
        "http": URLRouter(
            [
                url(
                    r"^api/v1/search/(?P<lookup_type>.+):(?P<lookup>.+)$",
                    consumers.SearchSingleConsumer,
Eliot Berriot's avatar
Eliot Berriot committed
24
25
                ),
                url(r"", AsgiHandler),
26
27
28
29
            ]
        )
    }
)