On Sep 29, 2:04 pm, sunn <jo...@kolben.se> wrote:
> Dear Django users,
>
> I am trying to create a simple redirect app (useful when rewriting a
> page that was previously not written in Django or when switching
> domains).
>
> The app would just collect all URLs not found so I put it at the end
> of urls.py
>
> (r'(?P<path>.*)', 'project.app.views.redirect')
>
> Problem is that I usually have another regex at the end that looks
> like this
>
> (r'', include( 'customproject.app.views.page')) and this view will
> throw a Http404 if no object is found so the redirect view never gets
> a chance.
>
> Is there a way to continue to the next regex in urls.py once inside a
> view? I do not want to mix in the redirect app in the customapp's view
> as I want to write redirect as a separate app.
>
> I know I can do this with mod_rewrite instead but I wanted a web
> interface.
>
> Thanks
> Jonas

No, there's no way to do that.

However, Django already includes a redirects app that doesn't use
urls.py, by using a middleware to check 404 responses. See the
documentation here:
http://docs.djangoproject.com/en/dev/ref/contrib/redirects/
--
DR.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to