urls.py 1.46 KB
Newer Older
1
# core django imports
2
from django.conf.urls import patterns, include, url
Jason D Yeomans's avatar
Jason D Yeomans committed
3
from django.contrib.auth.decorators import login_required
Daniel W Bond's avatar
Daniel W Bond committed
4
from django.views.generic import TemplateView
5
from django.contrib import admin
6
from django.views.decorators.cache import cache_page
7

8

9
admin.autodiscover()
Jason D Yeomans's avatar
Jason D Yeomans committed
10
admin.site.login = login_required(admin.site.login)
11

Daniel W Bond's avatar
Daniel W Bond committed
12 13
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
14

15
urlpatterns = patterns('',
16 17

    # project-level urls
18 19 20 21 22 23 24 25 26
    url(r'^$',
        cache_page(4)(TemplateView.as_view(template_name="index.html")),
        name='index'),
    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
27

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

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

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

39 40
    # 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
41

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