OpenSlides/openslides/urls.py

44 lines
1.6 KiB
Python
Raw Normal View History

from django.conf import settings
from django.conf.urls import include, url
2018-08-22 06:22:28 +02:00
from django.contrib.staticfiles.urls import urlpatterns
from django.views.generic import RedirectView
from openslides.mediafiles.views import protected_serve
from openslides.utils.rest_api import router
2012-04-15 11:24:40 +02:00
2018-08-22 06:22:28 +02:00
from .core import views as core_views
2018-08-22 06:22:28 +02:00
# Urls for /static/ are already in urlpatterns
urlpatterns += [
2018-08-22 06:22:28 +02:00
# URLs for /media/
url(r'^%s(?P<path>.*)$' % settings.MEDIA_URL.lstrip('/'), protected_serve, {'document_root': settings.MEDIA_ROOT}),
2018-08-22 06:22:28 +02:00
# When a url without a leading slash is requested, redirect to the url with
# the slash. This line has to be after static and media files.
url(r'^(?P<url>.*[^/])$', RedirectView.as_view(url='/%(url)s/', permanent=True)),
2018-08-22 06:22:28 +02:00
# URLs for the rest system
2015-01-30 11:58:36 +01:00
url(r'^rest/', include(router.urls)),
2018-08-22 06:22:28 +02:00
# Other urls defined by modules and plugins
url(r'^apps/', include('openslides.urls_apps')),
# The old angular webclient
# TODO: Change me or at least my comment
url(r'^webclient/(?P<realm>site|projector)/$',
core_views.WebclientJavaScriptView.as_view(),
name='core_webclient_javascript'),
# View for the projectors are handled by angular.
url(r'^projector/(\d+)/$', core_views.ProjectorView.as_view()),
# Original view without resolutioncontrol for the projectors are handled by angular.
url(r'^real-projector/(\d+)/$', core_views.RealProjectorView.as_view()),
# Main entry point for all angular pages.
# Has to be the last entry in the urls.py
url(r'^.*$', core_views.IndexView.as_view(), name="index"),
]