定义应用(student)的命名空间一般步骤:

第一步:应用(student)的url.py 文件添加如下代码:

# include()函数允许引用其他的 URLconf。每当 django 遇到 include(),它会截取 URL
# 中匹配到的前面的部分,并将剩余部分的字符串发送给包含的 URLconf 做进一步处理
app_name = 'studentform'

Django2 提示 "**" is not a registered namespace

第二步,项目(sutdentsite)配置应用(student)的url路径时候,添加namespace 空间定义。

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

Django2 提示 "**" is not a registered namespace

相关文章:

  • 2022-12-23
  • 2021-08-03
  • 2022-12-23
  • 2021-06-07
  • 2022-12-23
  • 2022-12-23
  • 2022-01-02
  • 2021-11-25
猜你喜欢
  • 2021-07-03
  • 2021-09-24
  • 2021-04-18
  • 2022-12-23
  • 2021-05-04
  • 2022-12-23
  • 2021-04-18
相关资源
相似解决方案