threaded-multihost

29 views
Skip to first unread message

Stuart Laughlin

unread,
May 4, 2010, 8:48:05 PM5/4/10
to satchm...@googlegroups.com
I'm having a problem getting satchmo to work in a multi-site
environment (latest of satchmo, threaded-multihost, and everything
else). I think it's threaded-multihost that's killing me. I seem to be
doing something threaded-multihost doesn't expect.

What i'm doing is serving two satchmo sites off the same host. For
example, if my host is "mycars.com", I have one satchmo store at
"mycars.com/vw" that sells Volkswagen-related products, and another
store at "mycars.com/corvette" that sells Corvette-related products.
I'm running apache+mod_wsgi (on debian stable), and so my httpd.conf
has two WSGIScriptAlias entries: one for /corvette and one for /vw.
Each points to its own wsgi file, each of which in turn points to a
particular settings file. The vw settings file has SITE_ID = 2 and the
corvette settings file has SITE_ID = 1. But threaded-multihost seems
to be ignoring that and trying to look up by hostname, which is not
unique in my case since both sites have a domain of 'mycars.com'.

The problem manifests itself in a few different ways, depending on how
I have things configured. If none of my django_site records match
(e.g. django_site.domain records are set to 'mycars.com' and I am
browsing to '10.10.20.20') then threaded-multihost goes into an
infinite loop and eventually throws a 'maximum recursion depth
exceeded' error. If multiple django_site records match (e.g.
django_site.domain records are all set to mycars.com and I browse to
mycars.com) then I get an 'expected one but got two' error originating
from threaded-multihost querying by hostname. The way I can actually
get it to (kind of) work is by adding /etc/hosts records on my client
machine, e.g. having both 'myvw.com' and 'myvette.com' resolve to
'mycars.com'. Then I can use those domains in my django_site records.
The problem with this approach is that when I browse to
"myvw.com/corvette" I get VW products, and when I browse to
"myvette.com/vw" I get Corvette products -- if you see what I mean.
Because threaded-multihost is looking up by hostname and hijacking my
SITE_ID, I guess you could say.

To reiterate, I don't want two unique domains. I want one domain to
host two satchmo sites, one in /vw and one in /corvette.

This used to work with the server I had setup from sources circa
February, but now, with latest of everything, it doesn't work.

Sorry for so many gory details. I am hoping this makes sense to
someone out there. Thanks in advance for any insight you can lend!


--Stuart

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

Bruce Kroeze

unread,
May 5, 2010, 12:22:35 PM5/5/10
to satchm...@googlegroups.com
I am the author of threaded-multihost, so maybe I can help.

On Tue, May 4, 2010 at 5:48 PM, Stuart Laughlin <stu...@bistrotech.net> wrote:
I'm having a problem getting satchmo to work in a multi-site
environment (latest of satchmo, threaded-multihost, and everything
else). I think it's threaded-multihost that's killing me. I seem to be
doing something threaded-multihost doesn't expect.

Yes, you are.
 

What i'm doing is serving two satchmo sites off the same host. For
example, if my host is "mycars.com", I have one satchmo store at
"mycars.com/vw" that sells Volkswagen-related products, and another
store at "mycars.com/corvette" that sells Corvette-related products.

I would suggest turning off the MULTISHOP option in your SATCHMO_SETTINGS entry.  You are manually handling the multiple shop setup, so there is no need to use the lookup-by-host method that threaded-multihost provides.
 
--
Bruce Kroeze
http://www.ecomsmith.com
It's time to hammer your site into shape.

Stuart Laughlin

unread,
May 5, 2010, 12:53:57 PM5/5/10
to satchm...@googlegroups.com
On Wed, May 5, 2010 at 11:22 AM, Bruce Kroeze <bkr...@gmail.com> wrote:
>
> I am the author of threaded-multihost, so maybe I can help.
>

Bruce, thanks for getting back to me!

>
> I would suggest turning off the MULTISHOP option in your SATCHMO_SETTINGS
> entry.  You are manually handling the multiple shop setup, so there is no
> need to use the lookup-by-host method that threaded-multihost provides.
>

Does threaded-multihost only kick into action when MULTISHOP is set to
true? I'll set it to false and see if that works.

Is it insane the way I have my shops set up? Am I making it needlessly
difficult on myself? Would you advise me to do things differently?


Thanks again,

--Stuart

Bruce Kroeze

unread,
May 5, 2010, 12:58:45 PM5/5/10
to satchm...@googlegroups.com
On Wed, May 5, 2010 at 9:53 AM, Stuart Laughlin <stu...@bistrotech.net> wrote:
>
> I would suggest turning off the MULTISHOP option in your SATCHMO_SETTINGS
> entry.  You are manually handling the multiple shop setup, so there is no
> need to use the lookup-by-host method that threaded-multihost provides.
>

Does threaded-multihost only kick into action when MULTISHOP is set to
true? I'll set it to false and see if that works.

There are two parts to threaded-multihost.  The multihost part, and the threadlocal variable part - which stores the request using a middleware and provides simple utilities to use the threadlocal variables. 

The multihost part is only active in Satchmo when MULTISHOP is true.  

The other part is active when the middleware is installed.  Satchmo requires that middleware, and it is used quite heavily.
 

Is it insane the way I have my shops set up? Am I making it needlessly
difficult on myself? Would you advise me to do things differently?

I'd just use two domains, but you aren't crazy.

--
Bruce Kroeze
http://www.ecomsmith.com
It's time to hammer your site into shape.

Stuart Laughlin

unread,
May 5, 2010, 3:28:24 PM5/5/10
to satchm...@googlegroups.com
I turned MULTISHOP to false on both my sites, and now everything seems
to be working great!

Thanks a ton, Bruce; it would be difficult to overstate how important
it was for me to get this working today!


--Stuart
Reply all
Reply to author
Forward
0 new messages