1

I haven't used Django for a long time. And I forgot how to solve a lot of usual issues. The site is on Dj 1.3. One day just started to return an error:

Exception Value:    
Reverse for 'page' with arguments '(u'yoga-class',)' and keyword arguments '{}' not found.

I'm not passing any args. The passed argument is domain name without domain zone, full domain is yoga-class.in.ua. Website worked for 2 years.

View:

class Index(ListView):
"""Front page, different from the list of posts just extra header.
On this page displayes category with checked "frontpage" checkbx."""

template_name = 'shivaapp/index.djhtml'
context_object_name = 'post_list'

def get_queryset(self):
    news = PostPages.objects.filter(parent_category__frontpage=True)
    news = news.order_by('move_to_top').reverse()
    return news

def get_context_data(self, **kwargs):
    """Extra data for header shifters."""

    context = super(Index, self).get_context_data(**kwargs)
    context['slideshow'] = ShivaImage.objects.filter(
                                    slide_show=True).order_by('ordering')
    context['dictums'] = Dictum.objects.order_by('ordering')
    return context

urls:

urlpatterns = patterns('',
    url(r'^$', Index.as_view(paginate_by=5)),
    (r'^feed/$', RSSFeed()),
    (r'^search', Search.as_view()),
    (r'^description/$', markdown_desc),
    (r'^redirect/(?P<url>\w+)/$', redirect_view),
    url(r'^cat/(?P<hash>[\w+\s]*)/$',
        CategorizedPostsView.as_view(paginate_by=5)),
    url(r'^page/(?P<slug>\w+)/$', PageOrSinglePost.as_view(), name='page'),
    url(r'^post/(?P<slug>\w+)/$', PageOrSinglePost.as_view(), name='post'),
)

httpd.conf:

Alias /robots.txt /var/www/path/to/robots.txt
Alias /favicon.ico  /var/www/path/to/favicon.ico

AliasMatch ^/([^/]*\.css) /var/www/i159/path/to/site_media/static/css/$1

Alias /media/ /var/www/i159/path/to/media/
Alias /static/ /var/www/i159/path/to/site_media/static/

<Directory /var/www/i159/path/to/static>
Order deny,allow
Allow from all
</Directory>

<Directory  /var/www/i159/path/to/media>
Order deny,allow
Allow from all
</Directory>

WSGIScriptAlias / /var/www/i159/path/to/deploy/wsgi.py
WSGIDaemonProcess local-shivablog.com python-   path=/var/www/i159/data/shivablog/:/usr/bin/python2.7/lib/python2.7/site-packages
WSGIPythonHome /usr/bin/python2.7/

<Directory /var/www/i159/path/to>
<Files wsgi.py>
Order allow,deny
Allow from all
</Files>
</Directory>

What should I look for?

1 Answer 1

2

In your url regex you are using \w+ where as the argument is yoga-class. The - does not belong in \w+ character class hence the error.

You need to update this:

url(r'^page/(?P<slug>\w+)/$', PageOrSinglePost.as_view(), name='page'),

to this:

url(r'^page/(?P<slug>[\w\-]+)/$', PageOrSinglePost.as_view(), name='page'),
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for helping! Pretty clear, but wonder that this stuff worked during 2 years!

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.