2016-08-04 11:08:12 +02:00
|
|
|
from django.conf import settings
|
2016-01-09 09:58:22 +01:00
|
|
|
from django.conf.urls import include, url
|
2015-06-16 10:37:23 +02:00
|
|
|
from django.views.generic import RedirectView
|
2013-11-29 16:47:31 +01:00
|
|
|
|
2017-08-30 12:58:51 +02:00
|
|
|
from openslides.mediafiles.views import protected_serve
|
2015-02-18 16:07:39 +01:00
|
|
|
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-07-09 23:22:26 +02:00
|
|
|
|
2018-08-22 06:22:28 +02:00
|
|
|
|
2018-10-13 08:41:51 +02:00
|
|
|
urlpatterns = [
|
2018-08-22 06:22:28 +02:00
|
|
|
# URLs for /media/
|
2019-01-06 16:22:33 +01:00
|
|
|
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.
|
2019-01-06 16:22:33 +01:00
|
|
|
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
|
2019-01-06 16:22:33 +01:00
|
|
|
url(r"^rest/", include(router.urls)),
|
2018-08-22 06:22:28 +02:00
|
|
|
# Other urls defined by modules and plugins
|
2019-01-06 16:22:33 +01:00
|
|
|
url(r"^apps/", include("openslides.urls_apps")),
|
2018-08-22 06:22:28 +02:00
|
|
|
# Main entry point for all angular pages.
|
|
|
|
# Has to be the last entry in the urls.py
|
2019-01-06 16:22:33 +01:00
|
|
|
url(r"^(?P<path>.*)$", core_views.IndexView.as_view(), name="index"),
|
2016-01-09 09:58:22 +01:00
|
|
|
]
|