flup

raw JSON →
1.0.3 verified Fri May 01 auth: no python maintenance

A random assortment of WSGI server implementations (CGI, FastCGI, SCGI, AJP) for Python 3. Version 1.0.3 is the latest, released in 2019. The project is in maintenance mode with no active development.

pip install flup
error ModuleNotFoundError: No module named 'flup'
cause Flup is not installed in the current Python environment.
fix
Run 'pip install flup'.
error AttributeError: module 'flup.server.fcgi' has no attribute 'FCGIServer'
cause In flup 1.0+, the class is named WSGIServer, not FCGIServer.
fix
Use 'from flup.server.fcgi import WSGIServer' instead.
error TypeError: WSGIServer.__init__() got an unexpected keyword argument 'bindAddress'
cause The keyword argument may be misspelled or not accepted in some older version; check the signature.
fix
Use positional arguments or consult the documentation: WSGIServer(app, bindAddress=...). Ensure you are using flup 1.0+.
error OSError: [Errno 98] Address already in use
cause The specified bind address/port is already occupied by another process.
fix
Choose a different port or stop the conflicting process.
gotcha Import paths differ between versions: in flup < 1.0, classes were directly under flup.server.* (e.g. flup.server.fcgi.FCGIServer); in 1.0+, use flup.server.*.WSGIServer.
fix Use 'from flup.server.fcgi import WSGIServer' instead of 'from flup.server.fcgi import FCGIServer'.
gotcha The server's run() method is blocking; to integrate with async frameworks, you need to manage threading yourself.
fix Wrap the server.run() in a thread if you need non-blocking operation.
deprecated Flup has no official Python 3 support beyond basic CGI. The package is unmaintained; consider alternatives like gunicorn or uWSGI.
fix Migrate to gunicorn (pip install gunicorn) or uWSGI for production use.
gotcha When using FastCGI, the bindAddress must be a Unix socket or TCP tuple. Using a string (e.g., '127.0.0.1:8080') will raise an error.
fix Use a tuple: bindAddress=('127.0.0.1', 8080) or a Unix socket path.

Basic FastCGI server example using flup. The server listens on localhost:8080.

from flup.server.fcgi import WSGIServer

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

server = WSGIServer(app, bindAddress=('127.0.0.1', 8080))
server.run()