Prevent Django from redirecting to add trailing slash

Posted by konrad on Stack Overflow See other posts from Stack Overflow or by konrad
Published on 2010-04-26T20:35:14Z Indexed on 2010/04/26 21:03 UTC
Read the original article Hit count: 307

Filed under:
|
|

UPDATED: Sorry, it looks like it's Apache that's rewriting it for some reason, not Django. I'll investigate further and post my findings.

I need to add a /xmlrpc.php to my Byteflow installation to handle an application that is written for PHP blog engines and uses this hardcoded path. For some reason Byteflow appends a slash to this URL using a 301 Moved Permanently redirect, which breaks the application. It does not do so for the /robots.txt that is configured in a similar way.

Relevant lines from the project urls.py:

url(r'^xmlrpc.php$', 'django_xmlrpc.views.xmlrpc_handler'),
url(r'^robots.txt$', include('robots.urls')),

I read that the behavior was changed in the Django codebase in commit 6852 (in 2007) to prevent redirects being done for urls that have been explicitly configured not to contain any trailing slashes. I'm using Django 1.1.

I assume that once I have fixed this problem, I should be able to use this application with Byteflow, because the application uses the MetaWeblog XML-RPC API.

Any clue?

© Stack Overflow or respective owner

Related posts about django

Related posts about django-urls