一运行就成这样了: django.urls.exceptions.NoReverseMatch: Reverse for 'bb' with arguments '('',)' not found. 1 pattern(s) tried: ['boke0/bc/(?P<boke_id>[0-9]+)$']
根URl代码:
from django.contrib import admin
from django.urls import path, include
# namespace='demo3_app'
urlpatterns = [
path('admin/', admin.site.urls),
path('boke0/', include('demo3_app.urls', namespace='demo3_app')),
]app URl代码
from django.urls import path, re_path
from . import views
app_name = 'demo3_app'
urlpatterns = [
path('88/', views.index),
re_path(r'^bc/(?P<boke_id>[0-9]+)$', views.article_contents, name='bb'),
]templates配置
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>博客入口</title>
</head>
<body>
<h1> <a href="">博客一览</a> </h1>
{% for ale in HH %}
<a href="{% url 'demo3_app:bb' boke.id %}">{{ale.title}}</a>
<br/>
{% endfor %}
</body>
</html>