Django URL Conf Returns Incorrect "Current URL"

Posted by natnit on Stack Overflow See other posts from Stack Overflow or by natnit
Published on 2010-05-29T11:55:05Z Indexed on 2010/05/29 12:32 UTC
Read the original article Hit count: 245

Filed under:
|

I have a django app that is mostly done, and the URLs work perfectly when I run it with the manage.py runserver command. However, I've recently tried to get it running via lighttpd, and many links have stopped working.

For example: http://mysite.com/races/32 should work, but instead throws this error message.

Page not found (404)
Request Method: GET
Request URL:    http://mysite.com/races/32
Using the URLconf defined in racetrack.urls, Django tried these URL patterns, in this order:
^admin/
^create/$
^races/$
^races/(?P<race_id>\d+)/$
^races/(?P<race_id>\d+)/manage/$
^races/(?P<text>\w+)/$
^user/(?P<kol_id>\d+)/$
^$
^login/$
^logout/$
The current URL, 32, didn't match any of these.

The request URL is accurate, but the last line (which displays the current URL) is giving 32 instead of races/32 as expected.

Here is my urlconf:

from django.conf.urls.defaults import *

from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('racetrack.races.views',
    (r'^admin/', include(admin.site.urls)),
    (r'^create/$', 'create'),
    (r'^races/$', 'index'),
    (r'^races/(?P<race_id>\d+)/$', 'detail'),
    (r'^races/(?P<race_id>\d+)/manage/$', 'manage'),
    (r'^races/(?P<text>\w+)/$', 'index'),
    (r'^user/(?P<kol_id>\d+)/$', 'user'),
    # temporary for index page replace with welcome page
    (r'^$', 'index'),
)

urlpatterns += patterns('django.contrib.auth.views',
    (r'^login/$', 'login', {'template_name': 'races/login.html'}),
    (r'^logout/$', 'logout', {'next_page': '/'}),
)

Thank you.

© Stack Overflow or respective owner

Related posts about django

Related posts about django-urls