Python 与#x27相反;用户帖子';带参数';(';';,)';找不到
我得到了一个例外: 找不到参数为“(“”,)”的“用户帖子”的反转。尝试了两种模式:[“用户/(?P[^/]+)(?P\.[a-z0-9]+/?)$”,“用户/(?P[^/]+)$”] 我不知道问题出在哪里 这是我的URL.pyPython 与#x27相反;用户帖子';带参数';(';';,)';找不到,python,django,Python,Django,我得到了一个例外: 找不到参数为“(“”,)”的“用户帖子”的反转。尝试了两种模式:[“用户/(?P[^/]+)(?P\.[a-z0-9]+/?)$”,“用户/(?P[^/]+)$”] 我不知道问题出在哪里 这是我的URL.py urlpatterns = [ path('', PostListView.as_view(), name='blog-home'), path('user/<str:username>', UserPostListView.as_view(), name=
urlpatterns = [
path('', PostListView.as_view(), name='blog-home'),
path('user/<str:username>', UserPostListView.as_view(), name='user-posts')
urlpatterns=[
路径(“”,PostListView.as_view(),name='blog-home'),
路径('user/',UserPostListView.as_view(),name='user-posts')
这是我的家
{% for post in posts %}
<article class="media content-section">
<img class="rounded-circle article-img" src="{{ post.author.image.url }}">
<div class="media-body">
<div class="article-metadata">
<a class="mr-2" href="{% url 'user-posts' post.author.username %}">{{ post.author }}</a>
<small class="text-muted">{{ post.date_posted|date:"F d, Y" }}</small>
</div>
<h2><a class="article-title" href="{% url 'post-detail' post.id %}">{{ post.title }}</a></h2>
<p class="article-content">{{ post.content }}</p>
</div>
</article>
{%for posts in posts%}
{{发布日期{发布日期:“F d,Y”}
{{post.content}
为什么会出现此异常?您可能有一篇文章的作者姓名为空。您的URL模式仅匹配非空字符串。您可能有一篇文章的作者姓名为空。您的URL模式仅匹配非空字符串