Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > How to investigate web script not running?

Reply
Thread Tools

How to investigate web script not running?

 
 
Gilles
Guest
Posts: n/a
 
      09-28-2012
Hello

I'm trying to run my very first FastCGI script on an Apache shared
host that relies on mod_fcgid:
==============
#!/usr/bin/python
from fcgi import WSGIServer
import cgitb

# enable debugging
cgitb.enable()

def myapp(environ, start_response):
start_response('200 OK', [('Content-Type', 'text/plain')])
return ['Hello World!\n']

WSGIServer(myapp).run()
==============

After following a tutorial, Apache complains with the following when I
call my script:
==============
Internal Server Error

The server encountered an internal error or misconfiguration and was
unable to complete your request.
==============

Generally speaking, what tools are available to investigate issues
when running a Python web app?

Thank you.
 
Reply With Quote
 
 
 
 
Gilles
Guest
Posts: n/a
 
      09-28-2012
On Fri, 28 Sep 2012 13:37:36 +0200, Gilles <> wrote:

>==============
>Internal Server Error
>
>The server encountered an internal error or misconfiguration and was
>unable to complete your request.
>==============


Looks like fcgi.py doesn't support WSGI:

Traceback (most recent call last):
File "hello.fcgi", line 2, in ?
from fcgi import WSGIServer
ImportError: cannot import name WSGIServer
 
Reply With Quote
 
 
 
 
Michael Ross
Guest
Posts: n/a
 
      09-28-2012
On Fri, 28 Sep 2012 13:37:36 +0200, Gilles <> wrote:

> Hello
>
> I'm trying to run my very first FastCGI script on an Apache shared
> host that relies on mod_fcgid:
> ==============
> #!/usr/bin/python
> from fcgi import WSGIServer
> import cgitb
>
> # enable debugging
> cgitb.enable()
>
> def myapp(environ, start_response):
> start_response('200 OK', [('Content-Type', 'text/plain')])
> return ['Hello World!\n']
>
> WSGIServer(myapp).run()
> ==============
>
> After following a tutorial, Apache complains with the following when I
> call my script:
> ==============
> Internal Server Error
>
> The server encountered an internal error or misconfiguration and was
> unable to complete your request.
> ==============



Do it the other way around:

# cgitb before anything else
import cgitb
cgitb.enable()

# so this error will be caught
from fcgi import WSGIServer



Regards,
Michael
 
Reply With Quote
 
Gilles
Guest
Posts: n/a
 
      09-28-2012
On Fri, 28 Sep 2012 14:16:22 +0200, "Michael Ross" <>
wrote:
>Do it the other way around:
>
># cgitb before anything else
>import cgitb
>cgitb.enable()
>
># so this error will be caught
> from fcgi import WSGIServer


Thanks much for the tip. The error isn't displayed when calling the
script from a web browser but it is when running the script on a shell
account.

It looks like that newer version of fcgi.py doesn't include support
for WSGI, and I need some extra (Flup?) software to sit between
mod_fcgid and a WSGI Python application.

Definitely not plug 'n play :-/
 
Reply With Quote
 
Ramchandra Apte
Guest
Posts: n/a
 
      09-29-2012
On Friday, 28 September 2012 18:45:41 UTC+5:30, Gilles wrote:
> On Fri, 28 Sep 2012 14:16:22 +0200, "Michael Ross" <>
>
> wrote:
>
> >Do it the other way around:

>
> >

>
> ># cgitb before anything else

>
> >import cgitb

>
> >cgitb.enable()

>
> >

>
> ># so this error will be caught

>
> > from fcgi import WSGIServer

>
>
>
> Thanks much for the tip. The error isn't displayed when calling the
>
> script from a web browser but it is when running the script on a shell
>
> account.
>
>
>
> It looks like that newer version of fcgi.py doesn't include support
>
> for WSGI, and I need some extra (Flup?) software to sit between
>
> mod_fcgid and a WSGI Python application.
>
>
>
> Definitely not plug 'n play :-/


Well the plug and play standard is superseded by USB practically.
 
Reply With Quote
 
Gilles
Guest
Posts: n/a
 
      09-30-2012
On Sat, 29 Sep 2012 10:05:25 -0700 (PDT), Ramchandra Apte
<> wrote:
>> Definitely not plug 'n play :-/

>
>Well the plug and play standard is superseded by USB practically.


Indeed

Anyway, Support finally got back to me, and it turns out that they
have Flup alreay installed on shared hosts, so I just have to provide
a WSGI script. OTOH, mod_fcgid is confured to wait 5mn or so before
checking if the script was edited, so I'll have to use a test host for
development and only use the shared host for deployment.

Thank all.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
INVESTIGATE ANYONE ANYWHERE IN THE US StephenR Computer Support 8 05-12-2006 11:21 PM
Is there are good place for me to go investigate the pro and cons. =?Utf-8?B?RnJvZ2xpcHM=?= Windows 64bit 13 11-19-2005 01:09 AM
Federal Trade Commission should investigate Canon CaptainKrunch Digital Photography 35 02-14-2004 03:15 PM
Re: Science and the Failure To Investigate Unidentified Aerial Phenomena Philip SC Computer Support 1 09-05-2003 09:50 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57