update conversions wl1 <-> wl2
[redakcja.git] / redakcja / urls.py
1 # -*- coding: utf-8 -*-
2
3 from django.conf.urls import include, patterns, url
4 from django.contrib import admin
5 from django.conf import settings
6 from django.conf.urls.static import static
7 from django.contrib.staticfiles.urls import staticfiles_urlpatterns
8 from django.views.generic import RedirectView
9
10
11 admin.autodiscover()
12
13 urlpatterns = patterns(
14     '',
15     # Auth
16     url(r'^accounts/login/$', 'django_cas.views.login', name='login'),
17     url(r'^accounts/logout/$', 'django_cas.views.logout', name='logout'),
18     url(r'^admin/login/$', 'django_cas.views.login', name='login'),
19     url(r'^admin/logout/$', 'django_cas.views.logout', name='logout'),
20
21     # Admin panel
22     url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
23     (r'^admin/', include(admin.site.urls)),
24
25     (r'^comments/', include('django.contrib.comments.urls')),
26
27     url(r'^$', RedirectView.as_view(url='/documents/')),
28     url(r'^documents/', include('catalogue.urls')),
29     url(r'^apiclient/', include('apiclient.urls')),
30     url(r'^editor/', include('wiki.urls')),
31     (r'^jsi18n/$', 'django.views.i18n.javascript_catalog', dict(packages=['wiki'])),
32 )
33
34 if settings.DEBUG:
35     urlpatterns += staticfiles_urlpatterns()
36     urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
37
38 if getattr(settings, 'SERVE_FILES_WITH_DEBUG_FALSE', False):
39     urlpatterns += patterns(
40         '',
41         (
42             r'^%s(?P<path>.*)$' % settings.STATIC_URL[1:],
43             'django.views.static.serve',
44             {'document_root': settings.STATIC_ROOT}
45         ),
46         (
47             r'^%s(?P<path>.*)$' % settings.MEDIA_URL[1:],
48             'django.views.static.serve',
49             {'document_root': settings.MEDIA_ROOT}
50         ),
51     )