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

Search Discussions

  • Gilles at Sep 28, 2012 at 12:13 pm
    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
  • Michael Ross at Sep 28, 2012 at 12:16 pm

    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
  • Gilles at Sep 28, 2012 at 1:15 pm

    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 :-/
  • Ramchandra Apte at Sep 29, 2012 at 5:05 pm

    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.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedSep 28, '12 at 11:37a
activeSep 29, '12 at 5:05p
posts5
users3
websitepython.org

People

Translate

site design / logo © 2022 Grokbase