urls.py 1.63 KB
Newer Older
David Haynes's avatar
David Haynes committed
1 2 3
"""
settings/urls.py

David Haynes's avatar
David Haynes committed
4 5
The URLs of the project and their associated view that requests are routed to.
"""
6
# Django Imports
David Haynes's avatar
David Haynes committed
7
import django.contrib.auth.views
8
from django.urls import path, re_path, include
9
from django.contrib import admin
Grady Moran's avatar
Grady Moran committed
10
from django.views.decorators.cache import cache_page
11 12 13
from django.views.generic import TemplateView

# App Imports
14 15
from go import views
from cas import views as cas_views
16 17 18 19 20

# Third Party
from rest_framework import routers

router = routers.DefaultRouter()
David Haynes's avatar
David Haynes committed
21
router.register(r'golinks', views.URLViewSet, base_name="golinks")
22

23 24
# This function attempts to import an admin module in each installed
# application. Such modules are expected to register models with the admin.
25 26
admin.autodiscover()

David Haynes's avatar
David Haynes committed
27
urlpatterns = [
28 29 30 31 32 33 34 35 36 37 38 39
    # Root API URL
    path("", include(router.urls)),

    # Authentication URLs
    path('auth/login/', cas_views.login, name='cas_login'),
    path('auth/logout/', cas_views.logout, {'next_page': '/'}, name='cas_logout'),

    # /admin - Administrator interface.
    path('admin/', admin.site.urls, name='go_admin'),
    path('auth/', include('rest_framework.urls'))


40 41 42 43 44
#     # /view/<short> - View URL data. Cached for 15 minutes
#     re_path(r'^view/(?P<short>([\U00010000-\U0010ffff][\U0000200D]?)+)$',
#             cache_page(60 * 15)(go.views.view), name='view'),
#     re_path(r'^view/(?P<short>[-\w]+)$',
#             cache_page(60 * 15)(go.views.view), name='view'),
45

46 47 48 49 50
#     # Redirection regex.
#     re_path(r'^(?P<short>([\U00010000-\U0010ffff][\U0000200D]?)+)$',
#             go.views.redirection, name='redirection'),
#     re_path(r'^(?P<short>[-\w]+)$',
#             go.views.redirection, name='redirection'),
David Haynes's avatar
David Haynes committed
51
]