turbogears-1.0.7 with lighttpd over scgi interface produces bad urls

1 view
Skip to first unread message

Bram Avontuur

unread,
Oct 13, 2008, 10:47:53 AM10/13/08
to TurboGears
Hi,

I'm trying to convert an existing turbogears project (v1.0.7) to run
under lighttpd (1.4.19) using the SCGI interface as documented here:
http://docs.turbogears.org/1.0/LightTPD

However, I found that this breaks url handling in turbogears. For
example, in the old situation, this would work:

http://myhost/mypage/edit/2

I can confirm this still works by starting the application the old-
fashioned way using cherrypy. When I start the application as an SCGI
process (as documented above), I get this error:

The path '/edit/2' was not found.

Page handler: "The path '/edit/2' was not found."
Traceback (most recent call last):
File ".../CherryPy-2.3.0-py2.5.egg/cherrypy/_cphttptools.py", line
123, in _run
self.main()
File ".../CherryPy-2.3.0-py2.5.egg/cherrypy/_cphttptools.py", line
258, in main
page_handler, object_path, virtual_path =
self.mapPathToObject(path)
File ".../CherryPy-2.3.0-py2.5.egg/cherrypy/_cphttptools.py", line
328, in mapPathToObject
raise cherrypy.NotFound(objectpath)
NotFound: 404

It seems to have dropped the 'mypage' bit from the url.

It works somewhat if I request: http://myhost/mypage/mypage/edit/2,
except that all links generated in the resulting page are now prefixed
with the 'mypage/' path prefix. If I switch back to using cherrypy
directly, things work like a charm.

Is this a known bug? How can I fix this or troubleshoot this? It seems
to go wrong in parsing the URL handling.

venkat

unread,
Oct 13, 2008, 11:30:04 AM10/13/08
to TurboGears
Hi Bram,

This appears to be an issue with lighty config, possibly the
server.document-root
setting.

I have this lighty/UDS front-ended scheme working just fine,
using TG 1x and Lighty 1.4.19

Best,
/venkat

Bram Avontuur

unread,
Oct 15, 2008, 6:25:10 AM10/15/08
to TurboGears
Hi Venkat,

I did change document-root to something other than the tg app dir
indeed. I now changed this, so that the document root is the directory
which contains the static/ subdir etc. Restarted lighttpd and the scgi
app, but the problem still persists.

http://myhost/mypage/edit/2 => doesn't work (still doesn't know about
edit/2)
http://myhost/any_random_string/mypage/edit/2 => it works! But all
links in the generated output prefix the /any_random_string to any
urls constructed with tg.url() (???)

What version of cherrypy are you using? Could this matter?

Graham

unread,
Nov 4, 2008, 6:16:30 AM11/4/08
to TurboGears
> venkat wrote:
> I did change document-root to something other than the tg app dir
> indeed. I now changed this, so that the document root is the directory
> which contains the static/ subdir etc. Restarted lighttpd and the scgi
> app, but the problem still persists.
>
Did you ever resolve this?

I've just updated to TurboGears 1.0.7, using scgi and lighttpd, and
I'm seeing the same problems.

tg.url() adds the TG instance to the name, ie tg.url('/static/
css/...') adds '/myapp' to the front

turbogears.redirect does not work on relative URLs,

all page calls are routed to Root.default() rather than the particular
function. ie the standard identity login does not work under scgi
unless you change the url to /myapp/login

all works fine with TG web server, just broken on SCGI

lighttpd config:

$HTTP["host"] == "www.ukcmg.org.uk" {
server.document-root = {path to folder that contains static,
templates etc}
server.errorlog = "/tmp/lighttpd.error.log"
accesslog.filename = "/tmp/lighttpd.access.log"

$HTTP["url"] !~ "^/static/" {
scgi.server = (
"/" =>
( "127.0.0.1" =>
(
"host" => "127.0.0.1",
"port" => 4000,
"check-local" => "disable"
)
)
)
}
}

Has anything changed in the SCGI server?

Any help appreciated, my TG site is barely working!
Reply all
Reply to author
Forward
0 new messages