Can't Figure Out How to Access the Login View #248

machineghost opened this Issue Sep 4, 2012 · 4 comments


None yet
3 participants

I've included the login view (as part of another include at "/api/") as described on the django-rest-framework site:

url(r'^restframework', include('djangorestframework.urls', namespace='djangorestframework')),

However, I have tried all of these URLs:


and they all give me 404s ... even the first one, despite the fact that the debug page shows:

 ^api/ ^restframework ^accounts/login/$ 

being one of the valid URL patterns.

So, my question is, what is the proper URL for the login/logout views? I tried looking through all the documentation, issues, and google group messages, but I couldn't find anywhere that mentioned it; even the curl example just says something like "/your-api" when describing how to login :-(

Also, a follow-up question: does "restframework" have to be part of the URL?


tomchristie commented Sep 4, 2012

The included urls are here:

In this case they'd be 'restframework/login' and 'restframework/logout'

Also, a follow-up question: does "restframework" have to be part of the URL?


tomchristie closed this Sep 4, 2012

Thanks for the links, they helped me track down the real problem: the website (on the front page no less) tells you to use:

url(r'^restframework', include('djangorestframework.urls', namespace='djangorestframework'))

but the website lies! ;-) Instead, it needs to be:

url(r'^restframework/', include('djangorestframework.urls', namespace='djangorestframework')),

(note the slash at the end of "restframework").

P.S. Would it be helpful for me to open a new ticket (with a title to the effect of "Add a '/' to the Sample Code on the Front Page") or is this ticket good enough?


tomchristie commented Sep 5, 2012

or is this ticket good enough?

This'll do. Fixed, and site updated.

Thanks @machineghost!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment