Reputation: 7098
If I have following url conf:
urlpatterns = patterns('',
url(r'^projects-json$', 'projects.views.list'),
)
And I go to /projects-json
URL resolves fine. Note there is no trailing slash.
But I want to have a dot, not a hyphen in URL, so I rewrite url conf in this way:
urlpatterns = patterns('',
url(r'^projects\.json$', 'projects.views.list'),
)
Now if I go to /projects.json
I get redirected to /projects.json/
and get 404 as a consequense! If I add a trailing slash in url pattern I will get OK response at URL with the trailing slash. But I just want one simple thing: to match /projects.json
without any redirects and slashes. Can Django do this? I've lost so many time for this primitive issue. Could anyone spot a mistake?
settings.APPEND_SLASH = False
. However looks like it doesn't matter. Just in case it could matter:
MEDIA_ROOT = ''
MEDIA_URL = '/media/'
ADMIN_MEDIA_PREFIX = '/admin-media/'
Upvotes: 2
Views: 997
Reputation: 31961
Works fine for me (with APPEND_SLASH = False
). It can be browser issue, some browsers (Firefox for example) cache redirects, so it will redirect you after there is no redirect at all at server. Try it in another browser.
Upvotes: 5