urls.py 1.56 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'^$',
22
        cache_page(4)(HomePageView.as_view()), name='homepage'),
23 24 25 26 27 28
    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
29

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

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

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

41 42
    # 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
43

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