Initial commit
[copyspeak.git] / src / copyspeak / urls.py
1 from django.conf.urls import patterns, include, url
2 from django.conf import settings
3 from words.views import HomeView, WordView
4
5 urlpatterns = patterns('',
6     url(r'^$', HomeView.as_view(), name='home'),
7 )
8
9 # Admin stuff, if necessary.
10 if 'django.contrib.admin' in settings.INSTALLED_APPS:
11     from django.contrib import admin
12     admin.autodiscover()
13
14     urlpatterns += patterns('',
15         url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
16         url(r'^admin/', include(admin.site.urls)),
17         url(r'^about/', include('django.contrib.flatpages.urls')),
18     )
19
20 urlpatterns += patterns('',
21     url(r'^(?P<slug>[^/]+)/$', WordView.as_view(), name='words_word'),
22 )
23
24 # Auth stuff, if necessary
25 if 'django_cas' in settings.INSTALLED_APPS:
26     urlpatterns += patterns('',
27         (r'^accounts/login/$', 'django_cas.views.login'),
28         (r'^accounts/logout/$', 'django_cas.views.logout'),
29     )
30
31 # Media in DEBUG mode
32 if settings.DEBUG:
33     urlpatterns += patterns('',
34         url(r'^media/(?P<path>.*)$', 'django.views.static.serve', {
35             'document_root': settings.MEDIA_ROOT,
36         }),
37    )