Django trailing slash not added

so i have a django application and i find this url:

http://127.0.0.1:8000/stories

and I get the following:

Request Method:     GET

Request URL:    http://127.0.0.1:8000/stories

"stories" does not exist

and then I look through urls.py and see:

#stories
url(r'^stories/$',
    StoryShowView.as_view(
        context_object_name='story_list',
        template_name='accounts/viewAndAddStory.html')
),

and finally, I look at my setupins.py and see:

#appends a slash if nothing is found without a slash.
APPEND_SLASH = True

shouldn't, with APPEND_SLASH installed, as mentioned above, a URL without a slash 301 is redirected to a URL with a slash, and then to load a web page?

if I manually add a slash to the URL, then the page will load as expected, and everyone has tea and knocks in the early morning.

UPDATE:

I also have this entry in my settings.py:

MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
)

UPDATE:

from the error message on the page when I try to access the URL:

Django Version: 1.3.1

RESOLVED: so om hit the money, dear. The problem was in my urls - right below, I had this:

if settings.DEBUG:
    urlpatterns += patterns('',
        url(r'^%s(?P<path>.*)$' % settings.MEDIA_URL[1:],
        'django.views.static.serve',
        {'document_root': settings.MEDIA_ROOT, 'show_indexes': True})
    )

, , MEDIA_URL MEDIA_ROOT settings.py - ('')

URL-, , , css. media_root (, css etc) media_url (url, ), .

+5
1

"does not exist" - "Page not found". , , 404, 404, urlconf. , , django.views.static.serve Http404('some_path does not exist'), urls.py, , static.serve, , /stories?

, Django .

from django.core.urlresolvers import resolve
resolve('/stories')

, .

+9

All Articles