from django.conf.urls import url from django.views.generic.base import RedirectView from . import views urlpatterns = [ url( regex=r'(?P\d+)/$', view=views.BookListView.as_view(), name='list', ), url( regex=r'(?P[-\w]+)/$', view=views.BookDetailView.as_view(), name='detail', ), url( regex=r'^$', view=RedirectView.as_view(url="/books/1/", permanent=False), name="live-redirect" ), ]