Sharing sessions between two Pylons sites

53 views
Skip to first unread message

Mike Orr

unread,
Aug 23, 2012, 5:10:57 PM8/23/12
to pylons-...@googlegroups.com
I need to share sessions between an existing Pylons site and a new
mobile-site derivative that's a subdomain (example.com and
m.example.com). So I need to share the session cookie and session
store. In the Beaker docs it says that
session.domain = .domain.com
will make the cookie shared across subdomains. That leaves the session
store. I'm using the default file-based sessions. If I just point the
two applications to the same session directory, will they do locking
properly?

Background info. The mobile site was made in a branch of the main
site. Ultimately we want to merge the codebases so that the same
application can respond to both domains, but I'm not sure we can
finish that before deployment. I'd rather convert the application to
Pyramid first. :) Also, the reason for sharing the sessions is that we
save search results in the session, and we want to preserve the
current search when the user switches to the full site or the mobile
site.

--
Mike Orr <slugg...@gmail.com>

Ronan Amicel

unread,
Aug 24, 2012, 5:51:02 AM8/24/12
to pylons-...@googlegroups.com
On Thu, Aug 23, 2012 at 11:10 PM, Mike Orr <slugg...@gmail.com> wrote:
> I need to share sessions between an existing Pylons site and a new
> mobile-site derivative that's a subdomain (example.com and
> m.example.com). So I need to share the session cookie and session
> store. In the Beaker docs it says that
> session.domain = .domain.com
> will make the cookie shared across subdomains. That leaves the session
> store. I'm using the default file-based sessions. If I just point the
> two applications to the same session directory, will they do locking
> properly?

If everything runs on a single server, I guess you can use file-based sessions.

If you want more flexibility, or want to avoid filesystem access, you
might want to look at Redis-backed sessions using beaker_extensions.

--
Ronan Amicel

«« Twitter overload?
»» Get your daily summary at http://focus.io/
Reply all
Reply to author
Forward
0 new messages