nk logo
[emels.git] / emels / urls.py
1 # -*- coding: utf-8 -*-
2 import django.views.static
3 from django.conf.urls import include, url
4 from django.conf import settings
5 from django_cas import views as cas_views
6 from migdal.urls import urlpatterns as migdal_urlpatterns
7
8 urlpatterns = (
9     url(r'^comments/', include('django_comments_xtd.urls')),
10 ) + tuple(migdal_urlpatterns)
11
12
13 # Admin stuff, if necessary.
14 if 'django.contrib.admin' in settings.INSTALLED_APPS:
15     from django.contrib import admin
16     admin.autodiscover()
17
18     if 'django_cas' in settings.INSTALLED_APPS:
19         urlpatterns += (
20             url(r'^admin/logout/$', cas_views.logout),
21         )
22     urlpatterns += (
23         url(r'^admin/', include(admin.site.urls)),
24     )
25
26 # Auth stuff, if necessary
27 if 'django_cas' in settings.INSTALLED_APPS:
28     urlpatterns += (
29         url(r'^accounts/login/$', cas_views.login, name='login'),
30         url(r'^accounts/logout/$', cas_views.logout, name='logout'),
31     )
32
33
34 if settings.DEBUG:
35     urlpatterns += (
36         url(r'^media/(?P<path>.*)$', django.views.static.serve, {
37             'document_root': settings.MEDIA_ROOT,
38         }),
39     )