views:

41

answers:

1

I have an existing Perl app that I'm moving to a Webfaction website. I will be adding Django apps to this Webfaction website too.

I would like the Django app to get first call and so would want its URL path to be /

This would allow me to add any new URLs to the urls.py I wish as my app grows.

If the URL doesn't match anything in the urls.py I would like it to get passed to the static Perl app.

For example

  • /app1 -> Django
  • /app2 -> Django

Everything else not picked up by urls.py I would want going to my Perl app

For example:

  • /index.html -> Static/Perl app
  • /about.html -> Static/Perl app
  • /contact.html -> Static/Perl app
  • /apps/perlapp1.cgi -> Static/Perl app

etc

How do I go about achieving this in Webfaction?

+1  A: 

The largest benefit of using a static app for the static pages (and not rendering them using simple views/templates using django) is the performance gain by not involving django at all in this request. but if you let django run and look through all the urls for a match, and only render static if there's not match, you're not getting that benefit.

I use /static/ as a location for the static app and / for django. so every request starting with /static/ skips the django server. whenever I want to link to static content I just add /static/ to it.

Ofri Raviv
The problem is I can't change the URLs of my existing website. Users will complain if they can't get to all the existing urls when I move over to Webfaction.
swisstony
How about adding a permanent redirect from those urls from their current_location to /static/current_location using djnago? (maybe even for each 404 - try to redirect to /staic/request.path).
Ofri Raviv
Thanks Ofri. I'll give that a go.
swisstony