urls.py 1.76 KB
Newer Older
1
# core django imports
Daniel W Bond's avatar
Daniel W Bond committed
2
from django.conf.urls import patterns, include, url
Daniel W Bond's avatar
Daniel W Bond committed
3
from django.views.generic import TemplateView
4
5
from django.conf.urls.static import static
from django.conf import settings
Jean Michel Rouly's avatar
Jean Michel Rouly committed
6
from django.contrib import admin
Daniel W Bond's avatar
Daniel W Bond committed
7
from django.views.decorators.cache import cache_page
8
# imports from your apps
9
from .views import HomepageView, ChartsView
10

Daniel W Bond's avatar
Daniel W Bond committed
11

Jean Michel Rouly's avatar
Jean Michel Rouly committed
12
admin.autodiscover()
Jean Michel Rouly's avatar
Jean Michel Rouly committed
13

Daniel W Bond's avatar
Daniel W Bond committed
14
handle403 = TemplateView.as_view(template_name="403.html")
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")
17

Daniel W Bond's avatar
Daniel W Bond committed
18
urlpatterns = patterns('',
19
    # app-level urls
Daniel W Bond's avatar
Daniel W Bond committed
20
    url(r'^share/', include('trades.urls')),
Daniel W Bond's avatar
Daniel W Bond committed
21
    url(r'^student/', include('core.urls')),
Daniel W Bond's avatar
Daniel W Bond committed
22
    url(r'^lookouts/', include('lookouts.urls')),
23
    url(r'^mod/', include('mod.urls')),
24

Daniel W Bond's avatar
Daniel W Bond committed
25
26
27
    # search
    url(r'^search/', include('haystack.urls'), name='search'),

28
    # site-wide pages
29
    # homepage is weird for cacheing... no special url, but different content
Daniel W Bond's avatar
Daniel W Bond committed
30
    # for each user
Daniel W Bond's avatar
Daniel W Bond committed
31
    url(r'^$', HomepageView.as_view(), name='homepage'),
Daniel W Bond's avatar
Daniel W Bond committed
32
    url(r'^charts/?$', cache_page(60 * 10)(ChartsView.as_view()), name='charts'),
33

Daniel W Bond's avatar
Daniel W Bond committed
34
    # static pages
35
36
    url(r'^about/?$',
        cache_page(60 * 15)(TemplateView.as_view(template_name='about.html')),
Daniel W Bond's avatar
Daniel W Bond committed
37
        name='about'),
38
39
    url(r'^privacy/?$',
        cache_page(60 * 15)(TemplateView.as_view(template_name='privacy.html')),
Daniel W Bond's avatar
Daniel W Bond committed
40
        name='privacy'),
41

Daniel W Bond's avatar
Daniel W Bond committed
42
    # user authentication
Daniel W Bond's avatar
Daniel W Bond committed
43
44
45
    url(r'^login/$', 'cas.views.login', name='login'),
    url(r'^logout/$', 'cas.views.logout', name='logout'),

Daniel W Bond's avatar
Daniel W Bond committed
46
    # admin pages
Daniel W Bond's avatar
Daniel W Bond committed
47
    url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
Jean Michel Rouly's avatar
Jean Michel Rouly committed
48
    url(r'^admin/', include(admin.site.urls)),
49

50
51
    # location of user-uploaded media files from settings.py (for local)
) #+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)