diff --git a/stagestatus/apps/machines/urls.py b/stagestatus/apps/machines/urls.py index 68e7fd4..c5b0e85 100644 --- a/stagestatus/apps/machines/urls.py +++ b/stagestatus/apps/machines/urls.py @@ -5,5 +5,5 @@ from machines.routers import router urlpatterns = [ url(r'^api/', include(router.urls)), url(r'^(?P\w+)/$', MachineDetail.as_view(), name='machine-detail'), - url(r'^$', MachineList.as_view()), + url(r'^$', MachineList.as_view(), name='machines-list'), ] diff --git a/stagestatus/urls.py b/stagestatus/urls.py index e629dcd..30ff39f 100644 --- a/stagestatus/urls.py +++ b/stagestatus/urls.py @@ -1,9 +1,9 @@ from django.conf.urls import url, include from django.contrib import admin -from django.views.generic import TemplateView +from stagestatus.views import redirect_machines urlpatterns = [ url(r'^admin/', admin.site.urls), - url(r'^machines/', include('machines.urls')), - url(r'^', TemplateView.as_view(template_name='index.html')), + url(r'machines/', include('machines.urls')), + url(r'', redirect_machines), ] diff --git a/stagestatus/views.py b/stagestatus/views.py new file mode 100644 index 0000000..318064f --- /dev/null +++ b/stagestatus/views.py @@ -0,0 +1,6 @@ +from django.http import HttpResponseRedirect +from django.shortcuts import reverse + + +def redirect_machines(request): + return HttpResponseRedirect(reverse('machines-list'))