9👍
✅
Check out the last response here. Instead of including the whole view as a string, import ‘obtain_auth_token’ first and then just refer to that.
from rest_framework.authtoken.views import obtain_auth_token
...
url(r'^api-token-auth/', obtain_auth_token),
...
Further update from agconti:
This issue stems from using:
urlpatterns = patterns("api.views",
...
url(r'^api-token-auth/', 'rest_framework.authtoken.views.obtain_auth_token'),
...
)
because of the views prefix. If you want to use api-token-auth/
this way you must change it to below or use the solution provided by Alex:
urlpatterns = patterns('',
...
url(r'^api-token-auth/', 'rest_framework.authtoken.views.obtain_auth_token'),
...
)
👤Alex
Source:stackexchange.com