urls.py 1.88 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
9
10
from django.contrib.auth.decorators import login_required
# third party imports
from haystack.views import SearchView
11
# imports from your apps
12
from .views import HomepageView, ChartsView
13

Daniel W Bond's avatar
Daniel W Bond committed
14

Jean Michel Rouly's avatar
Jean Michel Rouly committed
15
admin.autodiscover()
Jean Michel Rouly's avatar
Jean Michel Rouly committed
16

Daniel W Bond's avatar
Daniel W Bond committed
17
handle403 = TemplateView.as_view(template_name="403.html")
Daniel W Bond's avatar
Daniel W Bond committed
18
19
handle404 = TemplateView.as_view(template_name="404.html")
handle500 = TemplateView.as_view(template_name="500.html")
20

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

Daniel W Bond's avatar
Daniel W Bond committed
28
    # search
29
    url(r'^search/', login_required(SearchView(), login_url='login'), name='search'),
Daniel W Bond's avatar
Daniel W Bond committed
30

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

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

Daniel W Bond's avatar
Daniel W Bond committed
45
    # user authentication
Daniel W Bond's avatar
Daniel W Bond committed
46
47
48
    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
49
    # admin pages
Daniel W Bond's avatar
Daniel W Bond committed
50
    url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
Jean Michel Rouly's avatar
Jean Michel Rouly committed
51
    url(r'^admin/', include(admin.site.urls)),
52

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