diff --git a/readthedocs/core/urls/subdomain.py b/readthedocs/core/urls/subdomain.py index b867876960a..826c6443660 100644 --- a/readthedocs/core/urls/subdomain.py +++ b/readthedocs/core/urls/subdomain.py @@ -4,33 +4,40 @@ from functools import reduce from operator import add -from django.conf.urls import url, patterns +from django.conf.urls import url from django.conf import settings from django.conf.urls.static import static +from readthedocs.core.views.serve import ( + redirect_page_with_filename, + redirect_project_slug, serve_docs +) +from readthedocs.core.views import ( + server_error_500, + server_error_404, +) from readthedocs.constants import pattern_opts -handler500 = 'readthedocs.core.views.server_error' -handler404 = 'readthedocs.core.views.server_error_404' +handler500 = server_error_500 +handler404 = server_error_404 -subdomain_urls = patterns( - '', # base view, flake8 complains if it is on the previous line. +subdomain_urls = [ url(r'^(?:|projects/(?P{project_slug})/)' r'page/(?P.*)$'.format(**pattern_opts), - 'readthedocs.core.views.serve.redirect_page_with_filename', + redirect_page_with_filename, name='docs_detail'), url((r'^(?:|projects/(?P{project_slug})/)$').format(**pattern_opts), - 'readthedocs.core.views.serve.redirect_project_slug', + redirect_project_slug, name='redirect_project_slug'), url((r'^(?:|projects/(?P{project_slug})/)' r'(?P{lang_slug})/' r'(?P{version_slug})/' r'(?P{filename_slug})$'.format(**pattern_opts)), - 'readthedocs.core.views.serve.serve_docs', + serve_docs, name='docs_detail'), -) +] groups = [subdomain_urls] diff --git a/readthedocs/urls.py b/readthedocs/urls.py index 89c391fdd61..a123524d1f2 100644 --- a/readthedocs/urls.py +++ b/readthedocs/urls.py @@ -14,7 +14,8 @@ from readthedocs.api.base import (ProjectResource, UserResource, VersionResource, FileResource) from readthedocs.core.urls import docs_urls, core_urls, deprecated_urls -from readthedocs.core.views import HomepageView, SupportView +from readthedocs.core.views import (HomepageView, SupportView, + server_error_404, server_error_500) from readthedocs.search import views as search_views @@ -26,8 +27,8 @@ admin.autodiscover() -handler404 = 'readthedocs.core.views.server_error_404' -handler500 = 'readthedocs.core.views.server_error_500' +handler404 = server_error_404 +handler500 = server_error_500 basic_urls = [ url(r'^$', HomepageView.as_view(), name='homepage'),