I am learning both Django and the Django REST framework. I had this error before and fixed it. Now, this problem rears its head again.
This is the error I get when trying to get an auth token:
'module' object has no attribute 'views'
and this is my urls.py:
from django.conf.urls import include, url
import rest_framework
from rest_framework import authtoken
from . import views
urlpatterns = [
url(r'^games/$', views.GameList.as_view()),
url(r'^games/(?P<pk>[0-9]+)/$', views.GameDetail.as_view()),
url(r'^users/$', views.UserList.as_view()),
url(r'^users/(?P<pk>[0-9]+)/$', views.UserDetail.as_view()),
url(r'^api-token-auth/', authtoken.views.obtain_auth_token),
url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')),
]
Somehow it can't find authtoken.views. Annoying thing is, this worked fine until I restarted with manage.py runserver.