Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django Url Error: Unknown Specifier ?P\d

Tags:

django

My urls.py file is this:

urlpatterns = [
    url(r'^chat/(?P\d+)/$', views.chatindex_view, name='chatindex_view'),
]

and I'm getting this error while executing the runserver command:

in regex (regex, six.text_type(e))
django.core.exceptions.ImproperlyConfigured: "^chat/(?P\d+)/$" is not a valid regular expression: unknown specifier: ?P\d
like image 955
whinytween96 Avatar asked Dec 04 '25 11:12

whinytween96


1 Answers

That's not valid. Where is the keyword argument you are trying to get ?

url(r'^chat/(?P<id>\d+)/$', views.chatindex_view, name='chatindex_view'),
like image 74
Raja Simon Avatar answered Dec 07 '25 03:12

Raja Simon



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!