dolphinkickme
dolphinkickme

Reputation: 73

Including Django REST Framework urls returns 404

I get a 404 showing the following url patterns when I try to browse to http://localhost:8000/api/v1/api-dev/:

^api/v1/ ^api-dev/ ^login/$ [name='login']
^api/v1/ ^api-dev/ ^logout/$ [name='logout']

What's up with the whitespace and ^?

Here's the relevant code from the app.urls:

from django.conf.urls import patterns, url, include
urlpatterns = patterns('',

    url(r'^api/v1/', include('api.urls')),

)

And from the api.urls:

from django.conf.urls import patterns, url, include
from rest_framework import routers
from api.views import views


urlpatterns = patterns('',

    url(r'^api-dev/', include('rest_framework.urls', namespace='rest_framework')),

)

Upvotes: 2

Views: 1497

Answers (2)

dolphinkickme
dolphinkickme

Reputation: 73

Oh, the answer is just that I'm an idiot... there is no

http://localhost:8000/api/v1/api-dev/

Only http://localhost:8000/api/v1/api-dev/login

Upvotes: 1

Danny Brown
Danny Brown

Reputation: 304

Try removing the url part from both:

(r'^api/v1/', include('api.urls')),
(r'^api-dev/', include('rest_framework.urls', namespace='rest_framework')),

Upvotes: 0

Related Questions