Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Import Error: No module named urls" with Django 1.8 and Rest Framework 3.7

I'm using django==1.8, rest_framework=3.7.7, python==2.7.12

urls.py

urlpatterns += [
     url(r'^api/core/', include('core.urls')),
]

core/urls.py

urlpatterns=[
    url(r'^/users/', core_view.userlist),
]

views.py

class UserList(generics.ListAPIView):
queryset = User.objects.all()
serializer_class = UserSerializer
userlist = UserList.as_view()

When I'm navagating to: http://localhost:8000/api/core/users I'm getting the following error:

ImportError at /api/core/users
No module named urls
Request Method: GET
Request URL:    http://localhost:8000/api/core/users
Django Version: 1.8
Exception Type: ImportError
Exception Value:    
No module named urls
Exception Location: /usr/local/lib/python2.7/dist-packages/rest_framework/compat.py in <module>, line 26
Python Executable:  /usr/bin/python
Python Version: 2.7.12

what is wrong in configuration?

like image 675
108 Avatar asked Oct 16 '22 20:10

108


1 Answers

Django Rest Framework dropped support for Django 1.8 in version 3.7.

You should install an earlier version of rest framework, or upgrade Django (note that Django 1.8 reaches end-of-life in April 2018)

like image 169
Alasdair Avatar answered Oct 20 '22 07:10

Alasdair