Merge pull request #3798 from ostcar/url-schema

New url schema
This commit is contained in:
Oskar Hahn 2018-08-22 22:14:05 +02:00 committed by GitHub
commit d09086f08c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 98 additions and 34 deletions

View File

@ -4,6 +4,14 @@
https://openslides.org/
Version 3.0 (unreleased)
========================
Core:
- Change URL schema [#3798].
- Update to channels2
Version 2.3 (unreleased)
========================
@ -22,7 +30,7 @@ Motions:
be edited [#3781].
- New config to show amendments also in motions table [#3792]
Core:
Core:
- Python 3.4 is not supported anymore [#3777].
- Support Python 3.7 [#3786].
- Updated pdfMake to 0.1.37 [#3766].

View File

@ -214,9 +214,6 @@ This is an example configuration for a single Daphne listen on port 8000::
server_name _;
location ~* ^/(?!ws|wss|webclient|core/servertime|core/version|users/whoami|users/login|users/logout|users/setpassword|motions/docxtemplate|agenda/docxtemplate|projector|real-projector|static|media|rest).*$ {
rewrite ^.*$ /static/templates/index.html;
}
location ~* ^/projector.*$ {
rewrite ^.*$ /static/templates/projector-container.html;
}
@ -229,6 +226,9 @@ This is an example configuration for a single Daphne listen on port 8000::
location /static {
alias <your path to>/collected-static;
}
location ~* ^/(?!ws|wss|media|rest|views).*$ {
rewrite ^.*$ /static/templates/index.html;
}
location / {
proxy_pass http://localhost:8000;

View File

@ -4,26 +4,11 @@ from . import views
urlpatterns = [
url(r'^core/servertime/$',
url(r'^servertime/$',
views.ServerTime.as_view(),
name='core_servertime'),
url(r'^core/version/$',
url(r'^version/$',
views.VersionView.as_view(),
name='core_version'),
url(r'^webclient/(?P<realm>site|projector)/$',
views.WebclientJavaScriptView.as_view(),
name='core_webclient_javascript'),
# View for the projectors are handled by angular.
url(r'^projector/(\d+)/$', views.ProjectorView.as_view()),
# Original view without resolutioncontrol for the projectors are handled by angular.
url(r'^real-projector/(\d+)/$', views.RealProjectorView.as_view()),
# Main entry point for all angular pages.
# Has to be the last entry in the urls.py
url(r'^.*$', views.IndexView.as_view(), name="index"),
]

37
openslides/old_urls.py Normal file
View File

@ -0,0 +1,37 @@
from django.conf import settings
from django.conf.urls import include, url
from django.contrib.staticfiles.urls import urlpatterns
from django.views.generic import RedirectView
from openslides.core import views as core_views
from openslides.mediafiles.views import protected_serve
from openslides.utils.plugins import get_all_plugin_urlpatterns
from openslides.utils.rest_api import router
urlpatterns += get_all_plugin_urlpatterns()
urlpatterns += [
url(r'^%s(?P<path>.*)$' % settings.MEDIA_URL.lstrip('/'), protected_serve, {'document_root': settings.MEDIA_ROOT}),
url(r'^(?P<url>.*[^/])$', RedirectView.as_view(url='/%(url)s/', permanent=True)),
url(r'^rest/', include(router.urls)),
url(r'^agenda/', include('openslides.agenda.urls')),
url(r'^motions/', include('openslides.motions.urls')),
url(r'^users/', include('openslides.users.urls')),
url(r'^core/', include('openslides.core.urls')),
# 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"),
]

View File

@ -1,23 +1,43 @@
from django.conf import settings
from django.conf.urls import include, url
from django.contrib.staticfiles.urls import urlpatterns
from django.views.generic import RedirectView
from openslides.mediafiles.views import protected_serve
from openslides.utils.plugins import get_all_plugin_urlpatterns
from openslides.utils.rest_api import router
from .core import views as core_views
urlpatterns = get_all_plugin_urlpatterns()
# Urls for /static/ are already in urlpatterns
urlpatterns += [
# URLs for /media/
url(r'^%s(?P<path>.*)$' % settings.MEDIA_URL.lstrip('/'), protected_serve, {'document_root': settings.MEDIA_ROOT}),
url(r'^(?P<url>.*[^/])$', RedirectView.as_view(url='/%(url)s/', permanent=True)),
url(r'^rest/', include(router.urls)),
url(r'^agenda/', include('openslides.agenda.urls')),
url(r'^motions/', include('openslides.motions.urls')),
url(r'^users/', include('openslides.users.urls')),
# The urls.py of the core app has to be the last entry. It contains the
# main entry points for OpenSlides' browser clients.
url(r'^', include('openslides.core.urls')),
# 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)),
# URLs for the rest system
url(r'^rest/', include(router.urls)),
# 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"),
]

13
openslides/urls_apps.py Normal file
View File

@ -0,0 +1,13 @@
from django.conf.urls import include, url
from openslides.utils.plugins import get_all_plugin_urlpatterns
urlpatterns = get_all_plugin_urlpatterns()
urlpatterns += [
url(r'^core/', include('openslides.core.urls')),
url(r'^agenda/', include('openslides.agenda.urls')),
url(r'^motions/', include('openslides.motions.urls')),
url(r'^users/', include('openslides.users.urls')),
]

View File

@ -1,12 +1,13 @@
import json
from django.urls import reverse
from rest_framework.test import APIClient
from openslides.utils.test import TestCase
class TestWhoAmIView(TestCase):
url = '/users/whoami/'
url = reverse('user_whoami')
def test_get_anonymous(self):
response = self.client.get(self.url)
@ -32,7 +33,7 @@ class TestWhoAmIView(TestCase):
class TestUserLogoutView(TestCase):
url = '/users/logout/'
url = reverse('user_logout')
def test_get(self):
response = self.client.get(self.url)
@ -55,7 +56,7 @@ class TestUserLogoutView(TestCase):
class TestUserLoginView(TestCase):
url = '/users/login/'
url = reverse('user_login')
def setUp(self):
self.client = APIClient()