编辑器idea
使用的python版本 3.9.2
运行项目报错如下
raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: 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

解决方法
把以下代码

from django.conf.urls import url, include
from django.contrib import admin
from student import views
urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^student/', include('student.ursl', namespace="student"))
]

改为

from django.conf.urls import url, include
from django.contrib import admin
from student import views
urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^student/', include(('student.ursl',"student"), namespace="student"))
]
Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐