lighttpd + juno

1 view
Skip to first unread message

gm

unread,
May 29, 2009, 7:03:33 PM5/29/09
to juno-framework
Hello,

Does anyone have a simple recipe for using a single juno app in
lighttpd, as a resource (e.g. upload.py mapped as /upload) ?

I've been trying the docs example and an adaptation of django's recipe
but it seems to start my app just to let them die (and no request is
redirected).

Thanks a lot.

gm

Kacper Krupa

unread,
Jun 1, 2009, 10:33:42 AM6/1/09
to juno-framework
I've run simple app on lighty (via fcgi) and it works.

App:
#!/usr/bin/env python
from juno import run, get

@get('/')
def index(web):
return "hello form lighty"

run('fcgi')

Lighty conf:
$HTTP["host"] =~ "^trac\.pagenoare\.net$" {

fastcgi.server = (
"/main" => (
(
"bin-path" => "/home/pagenoare/www/
pagenoare.net/trac/main.py",
"socket" => "/tmp/juno.sock",
"check-local" => "disable",
"disable-time" => 1,
"min-procs" => 1,
"max-procs" => 1,
),
),
)

}

Diff of juno.py:
--- juno.py.tmp 2009-06-01 16:34:52.000000000 +0200
+++ juno.py 2009-06-01 16:26:31.000000000 +0200
@@ -770,7 +770,7 @@
def run_fcgi(addr, port, process_func):
from flup.server.fcgi import WSGIServer as FCGI
app = get_application(process_func)
- FCGI(app, bindAddress=(addr, port)).run()
+ FCGI(app).run()

def run_wsgi(process_func):
sys.stdout = sys.stderr


Regards,
Kacper.

Gleicon Moraes

unread,
Jun 1, 2009, 11:20:07 AM6/1/09
to juno-fr...@googlegroups.com
Thanks a lot, it solved my problem with lighttpd.
I made a patch of it:


--- juno_orig.py    2009-06-01 15:15:27.000000000 +0000
+++ juno.py    2009-06-01 15:14:56.000000000 +0000
@@ -769,7 +769,13 @@

 def run_fcgi(addr, port, process_func):
     from flup.server.fcgi import WSGIServer as FCGI
     app = get_application(process_func)
-    FCGI(app, bindAddress=(addr, port)).run()
+    #FCGI(app, bindAddress=(addr, port)).run()
+    if (port == 0):
+    FCGI(app).run()
+    else:
+        FCGI(app, bindAddress=(addr, port)).run()
+   
 
 def run_wsgi(process_func):
     sys.stdout = sys.stderr

You need to set 'fcgi_port':0 in init() so it will understand that no tcp binding is required.

I may try to use git to do it the proper way, later.

Best regards,

gm
--
More cowbell, please !

Kacper Krupa

unread,
Jun 1, 2009, 12:00:14 PM6/1/09
to juno-framework
On 1 Cze, 17:20, Gleicon Moraes <glei...@gmail.com> wrote:
> Thanks a lot, it solved my problem with lighttpd.
> I made a patch of it:
>

No problem.

I believe you could do it in one line (without if statement) but i've
to have a little bit more time to figure it out.

Regards.
Reply all
Reply to author
Forward
0 new messages