From c998d475440cf4819bad7ebc3ed19f31ce82baf4 Mon Sep 17 00:00:00 2001 From: Johannes Christ Date: Tue, 8 Jun 2021 00:26:40 +0200 Subject: Move subdomains to query paths. In more detail: - Use Django URL namespaces (e.g. `api:bot:infractions`) instead of `django_hosts` host argument. - Update the hosts file setup documentation to remove subdomain entries. - Update the hosts file setup documentation to mention that the entry of `pythondiscord.local` is not required and mainly for convenience. - Rename the `APISubdomainTestCase` to the more fitting `AuthenticatedAPITestCase`, as authentication is all that is left that the class is doing. - Drop dependency to `django_hosts`. --- pydis_site/apps/home/tests/test_views.py | 4 ++-- pydis_site/apps/home/urls.py | 8 +------- 2 files changed, 3 insertions(+), 9 deletions(-) (limited to 'pydis_site/apps/home') diff --git a/pydis_site/apps/home/tests/test_views.py b/pydis_site/apps/home/tests/test_views.py index bd1671b1..b1215df4 100644 --- a/pydis_site/apps/home/tests/test_views.py +++ b/pydis_site/apps/home/tests/test_views.py @@ -1,10 +1,10 @@ from django.test import TestCase -from django_hosts.resolvers import reverse +from django.urls import reverse class TestIndexReturns200(TestCase): def test_index_returns_200(self): """Check that the index page returns a HTTP 200 response.""" - url = reverse('home') + url = reverse('home:home') resp = self.client.get(url) self.assertEqual(resp.status_code, 200) diff --git a/pydis_site/apps/home/urls.py b/pydis_site/apps/home/urls.py index 1e2af8f3..57abc942 100644 --- a/pydis_site/apps/home/urls.py +++ b/pydis_site/apps/home/urls.py @@ -1,15 +1,9 @@ -from django.contrib import admin -from django.urls import include, path +from django.urls import path from .views import HomeView, timeline app_name = 'home' urlpatterns = [ path('', HomeView.as_view(), name='home'), - path('', include('pydis_site.apps.redirect.urls')), - path('admin/', admin.site.urls), - path('resources/', include('pydis_site.apps.resources.urls')), - path('pages/', include('pydis_site.apps.content.urls')), - path('events/', include('pydis_site.apps.events.urls', namespace='events')), path('timeline/', timeline, name="timeline"), ] -- cgit v1.2.3