title: Django REST Framework: How to add prefix in URL for versioning
body: <p>I am trying to create version for REST application. Here is my URL Examle</p>
  
  <pre><code>www.myapi.com/foo [default version]
  www.myapi.com/v1/foo [version one]
  </code></pre>
  
  <p>This is the project structure</p>
  
  <blockquote>
  <pre><code>├── __init__.py
  ├── settings.py
  ├── urls.py
  ├── default_app
  │ ├── __init__.py
  │ ├── serializer.py
  │ ├── models.py
  │ ├── views.py
  │ ├── urls.py
  │ 
  └── v1_app
  ├── __init__.py
  ├── serializer.py
  ├── models.py
  ├── views.py
  ├── urls.py
  </code></pre>
  </blockquote>
  
  <p><strong>default_app urls.py</strong>  </p>
  
  <pre><code>from django.conf.urls import *
  from default_app import views as df_views
  from rest_framework import routers
  
  router = routers.DefaultRouter()
  router.register(r'foo', df_views.viewname, "foo")
  urlpatterns = router.urls
  </code></pre>
  
  <p><strong>v1_app urls.py</strong></p>
  
  <pre><code>from django.conf.urls import *
  from v1_app import views as ver_views
  from rest_framework import routers
  
  router = routers.DefaultRouter()
  router.register(r'foo', ver_views.viewname, "foo")
  urlpatterns = router.urls
  </code></pre>
  
  <p><strong>main file for urls.py</strong></p>
  
  <pre><code>from django.conf.urls import patterns, include, url
  from defualt_app import urls as default_urls
  from v1_app import urls as v1_urls
  from django.contrib.staticfiles.urls import staticfiles_urlpatterns
  
  
  
  urlpatterns += patterns('',
      url(r'^', include(default_urls, namespace="default")),
      url(r'^v1/', include(v1_urls, namespace="v1"))
  )
  
  urlpatterns += staticfiles_urlpatterns()
  </code></pre>
  
  <p>My issue is, when i using simple url without any prefix then it is working</p>
  
  <blockquote>
    <p>www.myapi.com/foo</p>
  </blockquote>
  
  <p>and when i used version prefix v1 or v2 then it throws error [Page not found (404)]</p>
  
  <blockquote>
    <p>www.myapi.com/v1/foo</p>
  </blockquote>
  
  <p>I got this idea from this link
  <a href="https://stackoverflow.com/a/21839842/1558544">https://stackoverflow.com/a/21839842/1558544</a></p>
  
  <p>If I don't use middleware class then is this possible to get same result?</p>
  
  <p>Thank you</p>