On 2010-08-16, at 5:04 PM, Graham Dumpleton wrote:
> Further, there are implications in what is being done and how it
> affects SCRIPT_NAME passed to WSGI application. This is where the
> application thinks it is being mounted.
> 
> For your case, I would suggest the following is more likely what you need:
> 
>  WSGIScriptAliasMatch ^(/([a-z]){2}/) /home/django/django.wsgi$1
> 
> First difference is ensuring that pattern is anchored to start of URL.

Sorry, that was actually what is in the config, I simplified it.

> The second is having $1 on last argument.

> If you don't have $1 then SCRIPT_NAME will be different for each URL
> that matches a different pattern. This will stuff up Django if urls.py
> then also has the prefix as part of its rule set.

A thing we are good there.

> A second issue is that if don't have $1, and so SCRIPT_NAME is
> different, then by default each URL that matches a different pattern
> will be handled in a separate Django instance within distinct sub
> interpreter of the process. This will result in lots more memory being
> used.

That's a concern. I'd really rather not have the locale on there at all.

> To clarify what you need to do, you might describe how you are setting
> up urls.py and whether it also is dealing with locale in name, or you
> want the locale part of URL to vanish and it will be handled in some
> other way with actual request handlers.

The locale part of the URL should vanish. We are setting it using 
set_script_prefix in Django middleware so that all our urls.py and applications 
are unaware of locale being there at all. So the urls.py has for example:

url(r'^about/', 'some.app.view', name='about'),

We can then just do {% url about %} and will get /au/about/ (for example).

> If the latter and still want it all to happen in one Django instance,
> will probably want to override the application group (sub
> interpreter).
> 
> BTW, that pattern means that /au will return not found. Ie., only /au/
> will be handled. Did you want /au to somehow redirect automatically to
> /au/ or something?

Yep that's already set up as a redirect via RewriteRules.
--
  Andy McKay, @andymckay
  Django Consulting, Training and Support

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/modwsgi?hl=en.

Reply via email to