urls.py 1.54 KB
Newer Older
1 2
# standard library imports
from __future__ import absolute_import, print_function
3
# core django imports
4
from django.conf.urls import patterns, include, url
Jason D Yeomans's avatar
Jason D Yeomans committed
5
from django.contrib.auth.decorators import login_required
Daniel W Bond's avatar
Daniel W Bond committed
6
from django.views.generic import TemplateView
7
from django.contrib import admin
8
from django.views.decorators.cache import cache_page
9 10
# imports from your apps
from .views import HomePageView
11

12
admin.autodiscover()
Jason D Yeomans's avatar
Jason D Yeomans committed
13
admin.site.login = login_required(admin.site.login)
14

Daniel W Bond's avatar
Daniel W Bond committed
15 16
handle404 = TemplateView.as_view(template_name="404.html")
handle500 = TemplateView.as_view(template_name="500.html")
Daniel W Bond's avatar
Daniel W Bond committed
17

18
urlpatterns = patterns('',
19 20

    # project-level urls
21
    url(r'^$', HomePageView.as_view(), name='homepage'),
22 23 24 25 26 27
    url(r'^about/$',
        cache_page(60 * 15)(TemplateView.as_view(template_name='about.html')),
        name='about'),
    url(r'^privacy/$',
        cache_page(60 * 15)(TemplateView.as_view(template_name='privacy.html')),
        name='privacy'),
Daniel W Bond's avatar
Daniel W Bond committed
28

29 30
    # app-level urls
    url(r'^housing/', include('housing.urls')),
Jason D Yeomans's avatar
Jason D Yeomans committed
31
    url(r'^accounts/', include('accounts.urls')),
32

Daniel W Bond's avatar
Daniel W Bond committed
33 34 35
    # search
    url(r'^search/', include('haystack.urls'), name='search'),

Daniel W Bond's avatar
Daniel W Bond committed
36
    # login and logout
37
    url(r'^login/', 'accounts.views.custom_cas_login', name='login'),
38
    url(r'^logout/', 'cas.views.logout', name='logout'),
Jason D Yeomans's avatar
Jason D Yeomans committed
39

40 41
    # url(r'^login/$', 'django.contrib.auth.views.login', name='login'),
    # url(r'^logout/$', 'django.contrib.auth.views.logout', name='logout'),
Daniel W Bond's avatar
Daniel W Bond committed
42

43
    # alternate interfaces
44 45 46
    url(r'^api/', include('api.urls')),
    url(r'^admin/', include(admin.site.urls)),
)