This commit is contained in:
Tao Bojlen 2018-08-27 18:15:45 +02:00
parent 2c8f92130b
commit 4e0adc7579

View file

@ -13,7 +13,7 @@ Including another URLconf
1. Import the include() function: from django.urls import include, path 1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
""" """
from django.urls import path, include, re_path from django.urls import path, include
from django.views.generic import TemplateView from django.views.generic import TemplateView
from rest_framework import routers from rest_framework import routers
from apiv1 import views from apiv1 import views
@ -30,8 +30,8 @@ router = OptionalTrailingSlashRouter()
router.register(r'instances', views.InstanceViewSet) router.register(r'instances', views.InstanceViewSet)
urlpatterns = [ urlpatterns = [
path(r'api/v1/', include(router.urls)), path('api/v1/', include(router.urls)),
re_path(r'.*', TemplateView.as_view(template_name='index.html')), path('silk/', include('silk.urls', namespace='silk')),
path(r'silk/', include('silk.urls', namespace='silk')), path('', TemplateView.as_view(template_name='index.html')),
] ]