Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unknown specifier in URL when using Django-Tagging

Hi I am getting the following error;

    error at /
    unknown specifier: ?P[

This is what my URLS file looks like;

urlpatterns = patterns('mainpage.views',
(r'^$', 'index'),
(r'^post/(?P<id>\d+)/$', 'post'),
(r'^projects/$', 'projects'),
(r'^about/$', 'about'),
(r'^tags/$', 'tags'),
(r'^tag/(?P[-_A-Za-z0-9]+)/$', 'with_tag'),
(r'^tag/(?P[-_A-Za-z0-9]+)/page/(?Pd+)/$', 'with_tag'),                  
(r'^comments/$', include('django.contrib.comments.urls'))

The two URLS with a view name of with_tag are the offending urls. I am following this tutorial;

to get tagging working on my site. I am using Django-tagging 1.3.1 and Python 2.7.

Can anyone tell me what I am doing wrong to my URLS.py file please? I am copying the tutorial by the book but there must be something different in my set up compared to the set up used in the tutorial?

like image 261
jayduff2 Avatar asked Mar 13 '26 16:03

jayduff2


1 Answers

This is not related to django-tagging, it's a regex syntax error. ?P indicates a named group, and requires a name after it: ?P<foo>. So, either add names to your groups, or make them numbered (i.e. remove ?P part).

like image 117
Cat Plus Plus Avatar answered Mar 15 '26 05:03

Cat Plus Plus