Django catch-all URL without breaking APPEND_SLASH -
i have entry in urls.py acts catch-all loads simple view if finds appropriate page in database. problem approach url solver never fail, meaning append_slash functionality won't kick in - need.
i'd rather not have resort adding prefix static page urls stop being catch-all. know flatpages, uses 404 hook rather entry in urls.py, , had kinda hoped avoid having use it, guess problem might kind of reason why 1 use it.
any way round problem or should give in , use flatpages?
make sure catch-all url pattern has slash @ end, , pattern last in urlconf. if catch-all pattern doesn't end slash, match stray urls before middleware tries appending slash.
for example, use r'^.*/$'
instead of r'^.*'
last pattern.
to same, pass url view named argument, use r'^(?p<url>.*)/$'
.
Comments
Post a Comment