X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/950fe87b956be939ce4cc355ede2fc17c2be82df..49e1a0fdfaa15ac3cccb84fd993d68a72cc2a0b9:/platforma/urls.py diff --git a/platforma/urls.py b/platforma/urls.py index ccb9fcf7..1abc8992 100755 --- a/platforma/urls.py +++ b/platforma/urls.py @@ -5,58 +5,32 @@ from django.contrib import admin from django.conf import settings admin.autodiscover() -PATH_SEC = r"(?P[^/]+)" -PATH_END = PATH_SEC + "/$" -urlpatterns = patterns('', - # Explorer: - url(r'^$', 'explorer.views.file_list', name='file_list'), - url(r'^file/upload', 'explorer.views.file_upload', name='file_upload'), +if 'cas_consumer' in settings.INSTALLED_APPS: + auth_views = 'cas_consumer.views' +else: + auth_views = 'django.contrib.auth.views' - url(r'^management/pull-requests$', 'explorer.views.pull_requests'), - - # Editor panels - url(r'^editor/'+PATH_END, 'explorer.views.display_editor', name='editor_view'), - url(r'^editor/$', 'explorer.views.file_list', name='editor_base'), +urlpatterns = patterns('', + url(r'^$', 'wiki.views.document_list'), + url(r'^gallery/(?P[^/]+)$', 'wiki.views.document_gallery'), - url(r'^file/(?P[^/]+)/print$', 'explorer.views.print_html', name="file_print"), + # Auth + url(r'^accounts/login/$', auth_views + '.login', name = 'login'), + url(r'^accounts/logout/$', auth_views + '.logout', name = 'logout'), # Admin panel (r'^admin/filebrowser/', include('filebrowser.urls')), url(r'^admin/doc/', include('django.contrib.admindocs.urls')), url(r'^admin/(.*)', admin.site.root), - # Theme database - url(r'themes/', include('bookthemes.urls')), + # Static files (should be served by Apache) + url(r'^%s(?P.+)$' % settings.MEDIA_URL[1:], 'django.views.static.serve', + {'document_root': settings.MEDIA_ROOT, 'show_indexes': True}), + url(r'^%s(?P.+)$' % settings.ADMIN_MEDIA_PREFIX[1:], 'django.views.static.serve', + {'document_root': settings.MEDIA_ROOT, 'show_indexes': True}), + url(r'^%s(?P.+)$' % settings.STATIC_URL[1:], 'django.views.static.serve', + {'document_root': settings.STATIC_ROOT, 'show_indexes': True}), - # Our über-restful api - url(r'^api/', include('api.urls')), - + url(r'^(?P[^/]+)$', 'wiki.views.document_detail'), ) - -if 'cas_consumer' in settings.INSTALLED_APPS: - urlpatterns += patterns('', - # django-cas-consumer - url(r'^accounts/login/$', 'cas_consumer.views.login', name='login'), - url(r'^accounts/logout/$', 'cas_consumer.views.logout', name='logout'), - ) -else: - urlpatterns += patterns('', - # Django auth - url(r'^accounts/login/$', 'django.contrib.auth.views.login', {'redirect_field_name': 'next'}, name='login'), - url(r'^accounts/logout/$', 'django.contrib.auth.views.logout', {'next_page': '/'}, name='logout'), - ) - -# Static files -if settings.DEBUG: - urlpatterns += patterns('', - url(r'^renderer$', 'explorer.views.renderer_test'), - ) - - if not hasattr(settings, 'DONT_SERVE_STATIC'): - urlpatterns += patterns('', - url(r'^%s(?P.+)$' % settings.MEDIA_URL[1:], 'django.views.static.serve', - {'document_root': settings.MEDIA_ROOT, 'show_indexes': True}), - url(r'^%s(?P.+)$' % settings.STATIC_URL[1:], 'django.views.static.serve', - {'document_root': settings.STATIC_ROOT, 'show_indexes': True}), - ) \ No newline at end of file