这是我的问题:
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/
这是我的网址文件:
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()
仅删除尾随的$时,您不需要为 url 使用正则表达式。所以网址应该是-
path("bio/<slug:username>/", views.bio, name='bio')
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句