我收到这些错误
不支持在include()中指定名称空间而不提供app_name。在随附的模块中设置app_name属性,或传递包含模式列表和app_name的2元组。
我的代码如下所示
projectname.urls
from django.contrib import admin
from django.urls import path,include
urlpatterns = [
path('admin/', admin.site.urls),
path('',include('learnign.urls',namespace='learnign')),
]
app_name.urls
from django.urls import path
from learnign.views import SendEmail
urlpatterns = [
path('',SendEmail.as_view(),name='home')
]
答案 0 :(得分:1)
尝试以下解决方案:
from django.urls import path
from learnign.views import SendEmail
app_name = "learnign"
urlpatterns = [
path('',SendEmail.as_view(),name='home')
]