Maruthesh
Maruthesh

Reputation: 223

Specifying a namespace in include() without providing an app_name is not supported

I am getting these error

Specifying a namespace in include() without providing an app_name is not supported. Set the app_name attribute in the included module, or pass a 2-tuple containing the list of patterns and app_name instead.

my code is shown below

projectname.urls

from django.contrib import admin
from django.urls import path,include

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

app_name.urls

from django.urls import path
from learning.views import SendEmail

urlpatterns = [
   path('',SendEmail.as_view(),name='home')
]

Upvotes: 5

Views: 1178

Answers (1)

Maruthesh
Maruthesh

Reputation: 223

Try this solution:

from django.urls import path
from learning.views import SendEmail

app_name = "learning"

urlpatterns = [
    path('',SendEmail.as_view(),name='home')
]

Upvotes: 4

Related Questions