web.py cgi in web hosting

16 views
Skip to first unread message

frann...@gmail.com

unread,
Jan 30, 2006, 12:25:51 PM1/30/06
to web.py
Hi there,


Is there anyone who can running web.py as cgi in web hosting provider?

I tried with web.py homepage example (hello world)

python version and .cgi, permission are no problem. I checked.

But I still meet 'Internal Server Error' or blank page.
(blank page is shown when i add

print "Content-Type: text/plain\n\n"

so cgi is no problem)


After code traceing I found 'flup.server.fcgi' so I added flup but
still same error.
I suppose ThreadedServer.run is problem for cgi hosting.


Is there any solution?

I think running in general web hosting is most important factor of web
framework/api.

Deepak Sarda

unread,
Jan 30, 2006, 1:12:44 PM1/30/06
to we...@googlegroups.com
On 1/30/06, frann...@gmail.com <frann...@gmail.com> wrote:
> After code traceing I found 'flup.server.fcgi' so I added flup but
> still same error.
> I suppose ThreadedServer.run is problem for cgi hosting.

Can you disable this line from your app code:
web.internalerror = web.debugerror

and see if you still get an error? This requires Cheetah, and in some
scenario, my cgi app didn't work initially 'cos of this.

HTH

deepak

frann...@gmail.com

unread,
Jan 30, 2006, 1:56:02 PM1/30/06
to web.py

Deepak Sarda 작성:

becuase test app code is

urls = (
'/(.*)', 'hello'
)

class hello:
def GET(self, name):
i = web.input(times=1)
if not name: name = 'world'
for c in xrange(int(i.times)): print 'Hello,', name+'!'

if __name__ == "__main__": web.run(urls)
-----------------------------------------------
same as web.py homepage.

no web.internalerror or web.debugerror

thanks.

Will McCutchen

unread,
Jan 30, 2006, 2:03:30 PM1/30/06
to web.py
frann...@gmail.com wrote:
> becuase test app code is
>
> urls = (
> '/(.*)', 'hello'
> )
>
> class hello:
> def GET(self, name):
> i = web.input(times=1)
> if not name: name = 'world'
> for c in xrange(int(i.times)): print 'Hello,', name+'!'
>
> if __name__ == "__main__": web.run(urls)


I'm not sure, but you might try adding this to the top of the file:
#!/usr/bin/env python

frann...@gmail.com

unread,
Jan 30, 2006, 2:08:25 PM1/30/06
to web.py

Is WSGI(and ThreadedServer) is rely on 'long running process' ?
(most web hosting provider don't permit it)

frann...@gmail.com

unread,
Jan 30, 2006, 2:09:58 PM1/30/06
to web.py
Yup, I added it at my first try : )

frann...@gmail.com

unread,
Jan 30, 2006, 8:32:49 PM1/30/06
to web.py
I'm running my app as cgi with web.py 0.13 : )

woohoo-

Aaron Swartz

unread,
Jan 30, 2006, 9:44:32 PM1/30/06
to we...@googlegroups.com
> I'm running my app as cgi with web.py 0.13 : )

Glad to hear it and sorry for your problems. It looks like there was a
bug running as CGI under certain operating systems (like Mac OS X).

frann...@gmail.com

unread,
Jan 30, 2006, 11:43:50 PM1/30/06
to web.py

I think problem is flup and version of python.

Even web.py core file requires python 2.2 or later, flup requires
later. (or not)

my code is running after I added generator enable code (from __future__
import generators) to flup's fcgi.py code.

manatlan

unread,
Feb 2, 2006, 11:57:29 AM2/2/06
to web.py
thanx frannyjooey !!!
my web hosting provide python2.2 too !!!
i added your hack to flup ... and it works WELL now !
thanks a lot !!!!

Reply all
Reply to author
Forward
0 new messages