From fbacc83527daa56132461471d9093f1993086973 Mon Sep 17 00:00:00 2001 From: Koen Bolhuis Date: Wed, 26 Sep 2018 23:52:28 +0200 Subject: [PATCH] Serve index2.html and static files from / --- backend/RateMyCourse/urls.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/backend/RateMyCourse/urls.py b/backend/RateMyCourse/urls.py index 5417131..a3f6829 100644 --- a/backend/RateMyCourse/urls.py +++ b/backend/RateMyCourse/urls.py @@ -15,8 +15,19 @@ Including another URLconf """ from django.contrib import admin from django.urls import re_path,path,include +from django.conf.urls import url +from django.contrib.staticfiles.views import serve +from django.views.generic import RedirectView urlpatterns = [ + # / routes to index2.html + url(r'^$', serve, kwargs={'path': 'index2.html'}), + + # static files (*.css, *.js, *.jpg etc.) served on / + # (assuming Django uses /static/ and /media/ for static/media urls) + url(r'^(?!/?static/)(?!/?media/)(?P.*\..*)$', + RedirectView.as_view(url='/static/%(path)s', permanent=False)), + # /universities/1/ Shows the page for a university. # TODO: add pages for each rateable entity. path('admin/', admin.site.urls),