2

I tried to complete the drf quickstart tutorial from https://www.django-rest-framework.org/tutorial/quickstart/

using

Python 3.6.1

django-rest-framework 3.9.4

Django 2.2.1

but when I run

   python manage.py runserver

I got an error

  File "E:\Dropbox\python\drf2\venv\lib\site-packages\django\urls\resolvers.py", line 588, in url_patterns
    raise ImproperlyConfigured(msg.format(name=self.urlconf_name))
django.core.exceptions.ImproperlyConfigured: The included URLconf 'tutorial.urls' does not appear to have any patterns in it. If you see valid patterns in the file then the issue is probably caused by a circular import.

project structure:

enter image description here

the content of tutorial/urls.py

from django.urls import include, path
from rest_framework import routers
from tutorial.quickstart import views

router = routers.DefaultRouter()
router.register(r'users', views.UserViewSet)
router.register(r'groups', views.GroupViewSet)

# Wire up our API using automatic URL routing.
# Additionally, we include login URLs for the browsable API.
urlpatterns = [
    path('', include(router.urls)),
    path('api-auth/', include('rest_framework.urls', namespace='rest_framework'))
]
5
  • And what is your tutorial/urls.py? Commented May 16, 2019 at 5:39
  • seems like you've missed this portion of the tutorial Commented May 16, 2019 at 5:43
  • @Gasanov added to the post Commented May 16, 2019 at 5:54
  • @JPG I copy-pasted it from the tutorial as the last attempt to make it Commented May 16, 2019 at 5:56
  • 1
    @arpa if you want to follow that tutorial, your project structure is incorrect. Commented May 16, 2019 at 5:58

1 Answer 1

4

Your quickstart folder doesn't look at the right location. It should be at the same level as settings.py.

You can move the folder the quickstart to drf2/tutorial/tutorial and that would fix things.

NB, you likely missed the trailing dot in django-admin startproject tutorial .

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.