Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #30374 > unrolled thread

How to investigate web script not running?

Started byGilles <nospam@nospam.com>
First post2012-09-28 13:37 +0200
Last post2012-09-30 11:55 +0200
Articles 6 — 3 participants

Back to article view | Back to comp.lang.python


Contents

  How to investigate web script not running? Gilles <nospam@nospam.com> - 2012-09-28 13:37 +0200
    Re: How to investigate web script not running? Gilles <nospam@nospam.com> - 2012-09-28 14:13 +0200
    Re: How to investigate web script not running? "Michael Ross" <gmx@ross.cx> - 2012-09-28 14:16 +0200
      Re: How to investigate web script not running? Gilles <nospam@nospam.com> - 2012-09-28 15:15 +0200
        Re: How to investigate web script not running? Ramchandra Apte <maniandram01@gmail.com> - 2012-09-29 10:05 -0700
          Re: How to investigate web script not running? Gilles <nospam@nospam.com> - 2012-09-30 11:55 +0200

#30374 — How to investigate web script not running?

FromGilles <nospam@nospam.com>
Date2012-09-28 13:37 +0200
SubjectHow to investigate web script not running?
Message-ID<qq2b68p0tl7r2kqc3skdjrpo4qr642e3qd@4ax.com>
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.

[toc] | [next] | [standalone]


#30377

FromGilles <nospam@nospam.com>
Date2012-09-28 14:13 +0200
Message-ID<a25b6896o9fpb97log5j1t7bnutgdaffc8@4ax.com>
In reply to#30374
On Fri, 28 Sep 2012 13:37:36 +0200, Gilles <nospam@nospam.com> 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

[toc] | [prev] | [next] | [standalone]


#30380

From"Michael Ross" <gmx@ross.cx>
Date2012-09-28 14:16 +0200
Message-ID<mailman.1549.1348835893.27098.python-list@python.org>
In reply to#30374
On Fri, 28 Sep 2012 13:37:36 +0200, Gilles <nospam@nospam.com> 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

[toc] | [prev] | [next] | [standalone]


#30385

FromGilles <nospam@nospam.com>
Date2012-09-28 15:15 +0200
Message-ID<8h7b68lk4lakmgijhqeo918e01gh7pg7d2@4ax.com>
In reply to#30380
On Fri, 28 Sep 2012 14:16:22 +0200, "Michael Ross" <gmx@ross.cx>
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 :-/

[toc] | [prev] | [next] | [standalone]


#30511

FromRamchandra Apte <maniandram01@gmail.com>
Date2012-09-29 10:05 -0700
Message-ID<7f6dc32a-1052-486a-9b5f-140e2297395d@googlegroups.com>
In reply to#30385
On Friday, 28 September 2012 18:45:41 UTC+5:30, Gilles  wrote:
> On Fri, 28 Sep 2012 14:16:22 +0200, "Michael Ross" <gmx@ross.cx>
> 
> 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.

[toc] | [prev] | [next] | [standalone]


#30546

FromGilles <nospam@nospam.com>
Date2012-09-30 11:55 +0200
Message-ID<rh5g68d5gt5h58sr08fskvkpspcctmjks2@4ax.com>
In reply to#30511
On Sat, 29 Sep 2012 10:05:25 -0700 (PDT), Ramchandra Apte
<maniandram01@gmail.com> 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.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web