这是我的问题:
Using the URLconf defined in Rase.urls, Django tried these URL patterns, in this order:
admin/
[name='index']
bio/<slug:username>/$ [name='bio']
The current path, bio/bussiere/, didn't match any of these.
网址是:
http://localhost:8000/bio/bussiere/
这是我的url文件:
from django.urls import include, path
from . import views
urlpatterns = [
path('', views.index, name='index'),
path("bio/<slug:username>/$", views.bio, name='bio'),
]
如果你有任何想法?
感谢致敬
您正在使用Django 2.0.X,其中url发生了很大变化。使用path()
时,您不需要使用regex作为url,只需删除尾随的$。所以网址应该是 -
path("bio/<slug:username>/", views.bio, name='bio')