How to investigate web script not running?

G

Gilles

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.
 
G

Gilles

==============
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
 
M

Michael Ross

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
 
G

Gilles

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 :-/
 
R

Ramchandra Apte

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.
 
G

Gilles

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,708
Latest member
SherleneF1

Latest Threads

Top