from django.conf.urls import url from django.views.generic.base import RedirectView from . import views 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" ), ]