0

Here is my problem :

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.

the url is :

http://localhost:8000/bio/bussiere/

here is my url file :

from django.urls import include, path
from . import views

urlpatterns = [
    path('', views.index, name='index'),
    path("bio/<slug:username>/$", views.bio, name='bio'),
]

If you have any idea ?

Thanks and regards

4
  • 2
    You probably used url(..) instead of path(..) when specifying the url. As a result, it takes <slug:... as *lterally part of the URL, not as meta-data. Can you share the urlpatterns? Commented Jul 11, 2018 at 15:34
  • @WillemVanOnsem i've edited my post thanks Commented Jul 11, 2018 at 15:37
  • 3
    Remove the $ at the end Commented Jul 11, 2018 at 15:38
  • 2
    @user462794: you should remove the $ since that is a regex anchor, not a path specifier (or you should add a $ to your URL :) Commented Jul 11, 2018 at 15:38

1 Answer 1

1

You are using Django 2.0.X where url changed pretty much. You don't need to use regex for url when using path() just remove the trailing $ . So the url should be-

path("bio/<slug:username>/", views.bio, name='bio')
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.