Reputation: 19
I'm trying to match an url in a django project. My urls are like this http://localhost:8000/article/Google-Home-Sales-Outpace-Amazons-Alexa-For-The-First-Time-13545
and in urls.py
a have added:
path('article/(?P<article_title>[\w\d.\'%@+-]+)', views.article)
def article(request, article_title)):
pass
but this doesn't work. Can anyone help me?
Upvotes: 0
Views: 35
Reputation: 4668
Use re_path
instead of path
as shown in https://docs.djangoproject.com/en/2.0/topics/http/urls/
Upvotes: 1