cfa230013d31f35572c6759343dcb89096c6740f
[redakcja.git] / platforma / urls.py
1 # -*- coding: utf-8 -*-
2
3 from django.conf.urls.defaults import *
4 from django.contrib import admin
5 from django.conf import settings
6
7 admin.autodiscover()
8 PATH_SEC = r"(?P<path>[^/]+)"
9 PATH_END = PATH_SEC + "/$"
10
11
12
13 urlpatterns = patterns('')
14
15 if 'cas_consumer' in settings.INSTALLED_APPS:
16     urlpatterns += patterns('',
17         # django-cas-consumer
18         url(r'^accounts/login/$', 'cas_consumer.views.login', name = 'login'),
19         url(r'^accounts/logout/$', 'cas_consumer.views.logout', name = 'logout'),
20     )
21 else:
22     urlpatterns += patterns('',
23         # Django auth
24         url(r'^accounts/login/$', 'django.contrib.auth.views.login', {'redirect_field_name': 'next'}, name = 'login'),
25         url(r'^accounts/logout/$', 'django.contrib.auth.views.logout', {'next_page': '/'}, name = 'logout'),
26     )
27
28 urlpatterns += patterns('',
29     url(r'^$', 'wiki.views.document_list'),
30     url(r'^gallery/(?P<directory>[^/]+)$', 'wiki.views.document_gallery'),
31
32     # Admin panel
33     (r'^admin/filebrowser/', include('filebrowser.urls')),
34     url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
35     url(r'^admin/(.*)', admin.site.root),
36
37     # Static files (should be served by Apache)
38     url(r'^%s(?P<path>.+)$' % settings.MEDIA_URL[1:], 'django.views.static.serve',
39         {'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),
40     url(r'^%s(?P<path>.+)$' % settings.ADMIN_MEDIA_PREFIX[1:], 'django.views.static.serve',
41         {'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),
42     url(r'^%s(?P<path>.+)$' % settings.STATIC_URL[1:], 'django.views.static.serve',
43         {'document_root': settings.STATIC_ROOT, 'show_indexes': True}),
44
45     url(r'^(?P<name>[^/]+)$', 'wiki.views.document_detail'),
46
47 )
48