Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
MultilingualURLMiddleware with a subsite
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
paul_from_champs  
View profile  
 More options Jul 6 2011, 4:28 am
From: paul_from_champs <paoloromol...@gmail.com>
Date: Wed, 6 Jul 2011 01:28:26 -0700 (PDT)
Local: Wed, Jul 6 2011 4:28 am
Subject: MultilingualURLMiddleware with a subsite

Hi, I have a problem with MultilingualURLMiddleware  when using my
django-cms site on a subsite:
http://myserver/mysite/ <- this is the root of my django-cms site and when I
try to switch language  the patch_response function (I presume) from
MultilingualURLMiddleware replace the anchors like this:
http://myserver/en/mysite/ instead of http://myserver/mysite/en/.
I found this issue on an  old discussion<https://groups.google.com/forum/#%21topic/django-cms/rJPBxXbJkgU/disc...>but I couldn't find a clear solution.
Thanks a lot.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Manolis Stamatogiannakis  
View profile  
 More options Jul 6 2011, 7:02 am
From: Manolis Stamatogiannakis <msta...@gmail.com>
Date: Wed, 6 Jul 2011 14:02:15 +0300
Local: Wed, Jul 6 2011 7:02 am
Subject: Re: MultilingualURLMiddleware with a subsite

Hello Paul,

The middleware places language prefix after the 'pages-root' part of the
URLs. 'pages-root' matches the place where django-cms urlconf is included in
your URL hierarchy.

So, if you have the following line in your urlconf:
url(r'^', include('cms.urls'))
you should change it to:
url(r'^mysite', include('cms.urls'))

If your main site also runs django-cms, then you should include cms.urls
again *after* the subsite inclusion (or appropriately craft the regex in
your urlconf).

An alternative solution if you are using apache/mod_python is to set
django.root in your web server configuration. This approach would probably
be a better option if your main site doesn't run django. This is achieved by
adding the following line to the configuration block:
PythonOption django.root /mysite
Then your urlconf should have the usual:
url(r'^', include('cms.urls'))

Hope I've helped...

Cheers,
Manolis

2011/7/6 paul_from_champs <paoloromol...@gmail.com>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "R: Re: MultilingualURLMiddleware with a subsite" by paul_from_champs
paul_from_champs  
View profile  
 More options Jul 6 2011, 8:18 am
From: paul_from_champs <paoloromol...@gmail.com>
Date: Wed, 6 Jul 2011 05:18:09 -0700 (PDT)
Local: Wed, Jul 6 2011 8:18 am
Subject: R: Re: MultilingualURLMiddleware with a subsite

Hello Manolis,  I tried both options but I've got the same error. I'm
currently using apache with mod_python. From the apache conf file:

        <Location "/mysite">
                SetEnv DJANGO_SETTINGS_MODULE settings
                PythonInterpreter mysite
                SetHandler python-program
                PythonHandler django.core.handlers.modpython
                PythonOption django.root /mysite
                PythonDebug On
                PythonPath "['/srv/mysite'] + sys.path"
        </Location>
        Alias /mysite/media /srv/mysite/media
        <Directory /srv/mysite/media>
        Order deny,allow
        Allow from all
        </Directory>

and in my urls.py I 've included: url(r'^', include('cms.urls'))

Everything works fine, django, django admin the cms except the
MultilingualURLMiddleware . I've also tried removing django.root and editing
the urls.py as told but it doesn't work either.  Thanks alot for your answer


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "MultilingualURLMiddleware with a subsite" by Manolis Stamatogiannakis
Manolis Stamatogiannakis  
View profile  
 More options Jul 6 2011, 11:02 am
From: Manolis Stamatogiannakis <msta...@gmail.com>
Date: Wed, 6 Jul 2011 18:02:37 +0300
Local: Wed, Jul 6 2011 11:02 am
Subject: Re: Re: MultilingualURLMiddleware with a subsite

Hi Paul,

It turns out that I was not very up to date regarding the state of
MultilingualURLMiddleware. I just noticed this commit:
https://github.com/divio/django-cms/commit/c80003ce5680abf04e42cafb6a...

This breaks the code (which I had commited) that implements the behaviour I
described (the language code should be placed after 'pages-root'). Now the
behaviour is that the language code is always the first component of the
URL, regardless of your urlconf and django.root settings. This clearly
precludes your setup.

Now some discussion on the current implementation of
MultilingualURLMiddleware...

I understand that the aforementioned commit tries to fix
https://github.com/divio/django-cms/issues/559.

But even though the fix may work for the scenario described in the bug
report, it makes flawed assumptions. It assumes that *all* software you run
on your web server (django-cms, django, php...) support the language prefix
at the beggining of the URL. This doesn't sound like a realistic setup to
me.

The pre-c80003ce5680 code on the other hand assumed that django-cms operates
in its own namespace which starts from 'pages-root' without making any
assumptions for the configuration of the rest of the software you run on
your web server. For this, I find it much cleaner and more coherent wrt the
django config options (django.root, 'pages-root').

Although I favour the pre-c80003ce5680 functionality, I'd still be glad to
see MultilingualURLMiddleware phased out for something more elegant. I mean,
take a look on the monster regexs in multilingual.py... :-)

But if MultilingualURLMiddleware is here to stay, maybe the core developers
should discuss what is the correct behaviour for MultilingualURLMiddleware
and document it in the code so that we avoid further flip-flops.

Just my 2c...

Cheers,
Manolis

2011/7/6 paul_from_champs <paoloromol...@gmail.com>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »