How to use Nagare with Apache and mod_wsgi?

16 views
Skip to first unread message

Jouxsuke

unread,
Feb 17, 2009, 6:10:22 PM2/17/09
to Nagare users
Hello,

The Nagare framework is really great for its continuation feature and
other features.
I'm really grateful to the project members.

Anyway, I would like to setup my apps using Apache, mod_wsgi, and the
Nagare framework.
Are there already any standard way to do that?
Or am I too hasty because the project's status is still 0.1.0?

Thank u in advance.

apoirier

unread,
Feb 18, 2009, 2:58:41 PM2/18/09
to Nagare users
Hi,

> Hello,
>
> The Nagare framework is really great for its continuation feature and
> other features.
> I'm really grateful to the project members.

Thanks. We hope you're creating great applications with it :)

> Anyway, I would like to setup my apps using Apache, mod_wsgi, and the
> Nagare framework.

Currently Nagare can only serve the applications using its own
(``Paste`` one) multi-threaded HTTP server or a FastCGI multi-
processes server (http://www.nagare.org/trac/wiki/
PublisherConfiguration).

> Are there already any standard way to do that?

Sorry, but our applications in production are deployed using FastCGI,
memcached and supervisord. I don't have a practical experience of
mod_wsgi.

> Or am I too hasty because the project's status is still 0.1.0?

To be honest, I'm not sure setting a mod_wsgi env worth the effort
comparing to the simplicty of a FastCGI configuration.
Also, mod_wsgi is often used in the hope to get the best performances.
In this domain, our plan is rather to integrate a complete events/
tasklets based HTTP server with Nagare, that outperform the threaded/
processes based ones.

> Thank u in advance.

Regards

Jouxsuke

unread,
Feb 22, 2009, 11:12:06 AM2/22/09
to Nagare users
Hi, Poirier

Thank u for your polite reply.

> Sorry, but our applications in production are deployed using FastCGI,
> memcached and supervisord. I don't have a practical experience of
> mod_wsgi.
No problem.
I gave up using Nagare with mod_wsgi and I tried to use Nagare with
FastCGI and memcached.
And I got an error which says:

File "/usr/local/nagare/lib/python2.5/site-packages/nagare-0.1.0-
py2.5.egg/nag
are/sessions/common.py", line 256, in set
self._set(session_id, cont_id, new_id, secureid, query_string,
*self._dumps(
data))
TypeError: _set() takes exactly 7 arguments (8 given)" while reading
response he
ader from upstream, client: #.#.#.#, server: localhost, request:
"GET /
HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "#.#.#.#"

I saw the source code and the _set function didn't do anything,
so I commented out the self._set line and there happened no error.
It's just an ad hoc, but I report it any way.

Now, I came across another problem in the end.
I bound an anchor link with a class's method using h.a's action
method.
When I run my app using Nagare's web server,
The class' method was called and a component was swapped to another
component as I intended.
But when I run my app using a webserver(nginx) and FastCGI(Nagare),
The class' method was NEVER called.
I'm wondering there is some shortage of FastCGI parameters or cookie,
but have no idea at all(I made sure that cookies were sent to Nagare
using tcpdump).
Could u give me some hint?

> In this domain, our plan is rather to integrate a complete events/
> tasklets based HTTP server with Nagare, that outperform the threaded/
> processes based ones.
I'm quite interested in running my apps fast and making it scalable,
so your idea sounds pretty attractive and I'm looking forward to
seeing the completion.

Thanks.

apoirier

unread,
Feb 23, 2009, 2:19:24 PM2/23/09
to Nagare users
Hi,

On 22 fév, 17:12, Jouxsuke <jouxs...@gmail.com> wrote:
> Hi, Poirier
>
> Thank u for your polite reply.
>
> > Sorry, but our applications in production are deployed using FastCGI,
> > memcached and supervisord. I don't have a practical experience of
> > mod_wsgi.
>
> No problem.
> I gave up using Nagare with mod_wsgi and I tried to use Nagare with
> FastCGI and memcached.
> And I got an error which says:
>
> File "/usr/local/nagare/lib/python2.5/site-packages/nagare-0.1.0-
> py2.5.egg/nag
> are/sessions/common.py", line 256, in set
> self._set(session_id, cont_id, new_id, secureid, query_string,
> *self._dumps(
> data))
> TypeError: _set() takes exactly 7 arguments (8 given)" while reading
> response he
> ader from upstream, client: #.#.#.#, server: localhost, request:
> "GET /
> HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "#.#.#.#"

It's a bug that was corrected in revision r9. You can update to the
lastest SVN version with:

<NAGARE_HOME>/bin/easy_install -U "nagare[full]==dev"

> I saw the source code and the _set function didn't do anything,
> so I commented out the self._set line and there happened no error.
> It's just an ad hoc, but I report it any way.

The ``self._set()`` call is mandatory. The empy method in
``sessions.common`` is overrided in the
``sessions.memcached_sessions`` module.

> Now, I came across another problem in the end.
> I bound an anchor link with a class's method using h.a's action
> method.
> When I run my app using Nagare's web server,
> The class' method was called and a component was swapped to another
> component as I intended.
> But when I run my app using a webserver(nginx) and FastCGI(Nagare),
> The class' method was NEVER called.
> I'm wondering there is some shortage of FastCGI parameters or cookie,
> but have no idea at all(I made sure that cookies were sent to Nagare
> using tcpdump).
> Could u give me some hint?

It's because ``self._set()`` is not called. Retry with the SVN
version.
An application deployed in FastCGI must work exactly the same way than
with the standalone Python server, without any modification.

> > In this domain, our plan is rather to integrate a complete events/
> > tasklets based HTTP server with Nagare, that outperform the threaded/
> > processes based ones.
>
> I'm quite interested in running my apps fast and making it scalable,
> so your idea sounds pretty attractive and I'm looking forward to
> seeing the completion.
>
> Thanks.

Regards

Jouxsuke

unread,
Feb 24, 2009, 8:28:51 AM2/24/09
to Nagare users
Hello,

> It's because ``self._set()`` is not called. Retry with the SVN
> version.
> An application deployed in FastCGI must work exactly the same way than
> with the standalone Python server, without any modification.
I finally noticed my mistake after making sure that a new session is
created whenever I access my site.
I didn't add the line for the REQUEST_URI fastcgi parameter in the
webserver configuration file,
so Nagare didn't get the _s request parameter.
I'm really sorry for having bothered u.

By the way, I'm really enjoying creating a web application using
Nagare
because it's really a novel approach for it.

Thank u.
Reply all
Reply to author
Forward
0 new messages