How to use django-localeurl with Satchmo

102 views
Skip to first unread message

Christopher Hart

unread,
Jun 23, 2009, 5:51:30 PM6/23/09
to Satchmo users
After some fussing about we were able to get django-localeurl working
correctly.

Solution took a bit of searching to find: http://osdir.com/ml/DjangoUsers/2009-06/msg00668.html

Basically, localeurl.middleware.LocaleURLMiddleware should come before
django.middleware.common.CommonMiddleware in MIDDLEWARE_CLASSES, but
after everything else. If it is placed after CommonMiddleware,
APPEND_SLASH is broken as explained in the django-localeurl docs.
http://django-localeurl.googlecode.com/svn/tags/release-1.3/docs/.build/html/installation.html#id1

Here is what we have and it seems to work correctly:

MIDDLEWARE_CLASSES = (
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.locale.LocaleMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.middleware.doc.XViewMiddleware",
#The next middleware is required if you want to use satchmo
#to serve multiple simultaneous shops.
"threaded_multihost.middleware.ThreadLocalMiddleware",
"satchmo.shop.SSLMiddleware.SSLRedirect",
"satchmo.recentlist.middleware.RecentProductMiddleware",
"localeurl.middleware.LocaleURLMiddleware",
"django.middleware.common.CommonMiddleware",
)

Using Django 1.0.2 & Satchmo 0.8.1.

Christopher Hart

unread,
Jun 23, 2009, 6:51:57 PM6/23/09
to Satchmo users
Oh yeah:

You also need to change any links to the homepage from "{{ shop_base }}/" to "{{ shop_base }}/{{ LANGUAGE_CODE }}".

Bob Waycott

unread,
Jun 24, 2009, 9:04:01 AM6/24/09
to satchm...@googlegroups.com
That's good to know. Thanks.

אברהם סרור

unread,
Apr 5, 2013, 9:07:33 AM4/5/13
to satchm...@googlegroups.com
Hi,

I'm trying to add django-localeurl to my satchmo store, I followed the instructions here and it worked fine.
Now I'm trying to add a change language link
I tried the django-localeurl example:

{% for lang in LANGUAGES %}
            {% ifequal lang.0 LANGUAGE_CODE %}
                <li class="selected">{{ lang.1 }}</li>
            {% else %}
                <li><a href="{{ request.path|chlocale:lang.0 }}">{{ lang.1 }}</a></li>
            {% endifequal %}
        {% endfor %}

but I get AssertionError URL must start with SCRIPT_PREFIX
looks like request.path is always returning an empty string. the most relevant thing I could find was http://stackoverflow.com/questions/6764765/request-is-missing-from-context
but it didn't solve my problem.

anyone still using django-localeurl? it looks like abandoned, maybe it isn't compatible with django 1.4.5?

thanks
avraham

Avraham Serour

unread,
Apr 5, 2013, 11:26:31 AM4/5/13
to satchm...@googlegroups.com
Just found out that if I put the same code on base.html it works fine, the problem is when I tried to change l10n\_language_selection_form.html

but still not sure why


--
You received this message because you are subscribed to the Google Groups "Satchmo users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to satchmo-user...@googlegroups.com.
To post to this group, send email to satchm...@googlegroups.com.
Visit this group at http://groups.google.com/group/satchmo-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages