730b768075d6eff9d9f89270d38d931bae81c6aa
[prawokultury.git] / prawokultury / urls.py
1 # -*- coding: utf-8 -*-
2 # This file is part of PrawoKultury, licensed under GNU Affero GPLv3 or later.
3 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
4 #
5 from django.conf import settings
6 from django.conf.urls import include, url
7 from django.contrib import admin
8 import django.contrib.sitemaps.views
9 from django.contrib.staticfiles.urls import staticfiles_urlpatterns
10 from django.utils.translation import ugettext_lazy as _, string_concat
11 import django_cas_ng.views
12 from fnpdjango.utils.urls import i18n_patterns
13 from events.urls import urlpatterns as events_urlpatterns
14 from migdal.urls import urlpatterns as migdal_urlpatterns
15 from migdal.sitemap import sitemaps as migdal_sitemaps
16 from questions.sitemap import sitemaps as question_sitemaps
17
18 admin.autodiscover()
19
20 urlpatterns = [
21     url(r'^taggit_autosuggest/', include('taggit_autosuggest.urls')),
22
23     url(r'^sitemap\.xml$', django.contrib.sitemaps.views.sitemap, {
24         'sitemaps': dict(migdal_sitemaps.items() + question_sitemaps.items())
25     }),
26
27     url(r'^accounts/login/$', django_cas_ng.views.login),
28     url(r'^accounts/logout/$', django_cas_ng.views.logout),
29     url(r'^admin/login/$', django_cas_ng.views.login),
30     url(r'^admin/logout/$', django_cas_ng.views.logout),
31
32     url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
33     url(r'^admin/', include(admin.site.urls)),
34 ]
35
36 urlpatterns += i18n_patterns(
37     url(string_concat(r'^', _('events'), r'/'), include('events.urls')),
38     url(r'^comments/', include('django_comments_xtd.urls')),
39     url(r'^pierwsza-pomoc/', include('questions.urls')),
40     url(string_concat(r'^', _('shop'), r'/'), include('shop.urls')),
41 ) + migdal_urlpatterns 
42
43 if settings.DEBUG:
44     import django.views.static
45     urlpatterns += [
46         url(r'^media/(?P<path>.*)$', django.views.static.serve, {
47             'document_root': settings.MEDIA_ROOT,
48         }),
49    ]
50
51 urlpatterns += staticfiles_urlpatterns()