urls.py 1.44 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
admin.autodiscover()
Jason D Yeomans's avatar
Jason D Yeomans committed
9
admin.site.login = login_required(admin.site.login)
10

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

14
urlpatterns = patterns('',
15 16

    # project-level urls
17 18 19 20 21 22 23 24 25
    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
26

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

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

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

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

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