diff options
Diffstat (limited to 'pydis_site/urls.py')
-rw-r--r-- | pydis_site/urls.py | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/pydis_site/urls.py b/pydis_site/urls.py index 891dbdcc..6cd31f26 100644 --- a/pydis_site/urls.py +++ b/pydis_site/urls.py @@ -1,8 +1,9 @@ from django.contrib import admin from django.urls import include, path +from pydis_site import settings -urlpatterns = ( +NON_STATIC_PATTERNS = [ path('admin/', admin.site.urls), # External API ingress (over the net) @@ -10,13 +11,25 @@ urlpatterns = ( # Internal API ingress (cluster local) path('pydis-api/', include('pydis_site.apps.api.urls', namespace='internal_api')), + path('', include('django_prometheus.urls')), +] if not settings.env("STATIC_BUILD") else [] + + +urlpatterns = ( + *NON_STATIC_PATTERNS, + # This must be mounted before the `content` app to prevent Django # from wildcard matching all requests to `pages/...`. path('', include('pydis_site.apps.redirect.urls')), - path('', include('django_prometheus.urls')), + path('pages/', include('pydis_site.apps.content.urls', namespace='content')), path('resources/', include('pydis_site.apps.resources.urls')), path('events/', include('pydis_site.apps.events.urls', namespace='events')), - path('staff/', include('pydis_site.apps.staff.urls', namespace='staff')), path('', include('pydis_site.apps.home.urls', namespace='home')), ) + + +if not settings.env("STATIC_BUILD"): + urlpatterns += ( + path('staff/', include('pydis_site.apps.staff.urls', namespace='staff')), + ) |