/ 'QuizApp' 处的 NoReverseMatch 不是 'basic_app' 内的注册名称空间

NoReverseMatch at / 'QuizApp' is not a registered namespace inside 'basic_app'

我想将我的 basic_app 与 index.html(我的测验应用程序的 index.html)文件连接起来,该文件位于 basic_app 文件夹中,但它位于像这样 - basic_app/QuizApp/index.html 这个问题可能是关于在我的 basic_app 文件夹中有其他文件夹并从那里调用 .html 文件的原理,这是一个问题我正在挣扎。

这是我的看法 -

def quizindex(request):
    return render(request,'basic_app/QuizApp/index.html')

这是对应的urlpattern -

url(r'^quizindex/$', views.quizindex, name='quizindex'),

这是位于我主页上的锚标记,(主要 index.html 位于这样 - basic_app/index.html)指向实际 index.html测验 - (老实说,我不确定以下代码是否以正确的方式编写)

<a href="{% url 'basic_app:QuizApp:register' %}">QUIZ</a>

我该如何解决这个错误?

你必须调用你的路径名quizindex

试试这个:

<a href="{% url 'quizindex' %}">QUIZ</a>