Reputation: 408
When I try runserver, there is an error at this regular expression:
url(r'^articles/get/(?<article_id>)\d+/$', views.article)
Can you please explain - where I was wrong?
Upvotes: 1
Views: 181
Reputation: 627448
You must be looking for
^articles/get/(?P<article_id>\d+)/$
^ ^^^^
See the regex demo
The first issue is that you failed to use a named capture group correctly, and the second issue is that you did not capture anything by setting the closing )
right after the group name, while you want to capture 1+ digits with the \d+
into the article_id
group.
Also, some reference on the named groups can be found here:
(?P<name>...)
Similar to regular parentheses, but the substring matched by the group is accessible via the symbolic group name name.
Upvotes: 2