[Answered ]-(Django) include does not import other apps' urls

1👍

Now GraphQLView is called with the URL 127.0.0.1:8000/graphql/, if you want to call it with the URL 127.0.0.1:8000/, you need to change your code:

core/urls.py

from django.contrib import admin
from django.urls import path
from django.conf.urls import include
# local

urlpatterns = [
    path('/', include('books.urls')),
    path('admin/', admin.site.urls),
]

books/urls.py

from django.contrib import admin
from django.urls import path
# local
from graphene_django.views import GraphQLView
from books.schema import schema

urlpatterns = [
    path('/', GraphQLView.as_view(graphiql=True, schema=schema)), 
]

Leave a comment