1ba97d65fbd10e37894af224c8069d1c7e930dbb
[redakcja.git] / project / urls.py
1 from django.conf.urls.defaults import *
2 from django.contrib import admin
3 from django.conf import settings
4
5
6 admin.autodiscover()
7
8
9 urlpatterns = patterns('',
10     # Explorer:
11     url(r'^$', 'explorer.views.file_list', name='file_list'),
12     url(r'^file/(?P<path>[^/]+)/$', 'explorer.views.file_xml', name='file_xml'),
13     url(r'^images/(?P<folder>[^/]+)/$', 'explorer.views.folder_images', name='folder_image'),
14     url(r'^images/$', 'explorer.views.folder_images', {'folder': '.'}, name='folder_image_ajax'),
15     
16     # Editor panels
17     url(r'^editor/(?P<path>[^/]+)/panels/xmleditor/$', 'explorer.views.xmleditor_panel', name='xmleditor_panel'),
18     url(r'^editor/(?P<path>[^/]+)/panels/gallery/$', 'explorer.views.gallery_panel', name='gallery_panel'),
19     url(r'^editor/(?P<path>[^/]+)/panels/htmleditor/$', 'explorer.views.htmleditor_panel', name='htmleditor_panel'),
20     
21     # Admin panel
22     url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
23     url(r'^admin/(.*)', admin.site.root),
24
25     # Authorization
26     url(r'^accounts/login/$', 'django.contrib.auth.views.login', {'redirect_field_name': 'next_page'}),
27     url(r'^accounts/logout$', 'django.contrib.auth.views.logout', {'next_page': '/'}), # {'redirect_field_name': 'next_page'}),
28 )
29
30
31 # Static files
32 if settings.DEBUG:
33     urlpatterns += patterns('',
34         url(r'^%s(?P<path>.+)$' % settings.MEDIA_URL[1:], 'django.views.static.serve', 
35             {'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),
36         url(r'^%s(?P<path>.+)$' % settings.STATIC_URL[1:], 'django.views.static.serve',
37             {'document_root': settings.STATIC_ROOT, 'show_indexes': True}),
38     )