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