pneff / flup-py3

http://hg.saddi.com/flup-py3.0/ updated for Python 3.4+ (but please use WSGI!)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

flup-py3 for Python 3.4+

flup-py3 fork and updated for Python 3.4+.

Please note that WSGI is the preferable way for Python based web applications.

Installation

You may install this package by using pip for Python 3. Optionally with the help of venv.

The actual command is different among operation systems. For example, Debian / Ubuntu package name it as pip3.

Add this line to your requirements.txt:

flup-py3

Then run this command (assuming pip3):

pip3 install -r requirements.txt

Usage

A simple hello world app (reference: Python 3.4 Documentations)

import sys, os, logging
from html import escape
from flup.server.fcgi import WSGIServer

def app(environ, start_response):
    start_response('200 OK', [('Content-Type', 'text/html')])
    yield "hello world"

def main():
    try:
        WSGIServer(app, bindAddress='./hello-world.sock', umask=0000).run()
    except (KeyboardInterrupt, SystemExit, SystemError):
        logging.info("Shutdown requested...exiting")
    except Exception:
        traceback.print_exc(file=sys.stdout)

Maintenance

Github Repository: github.com/pquentin/flup-py3

About

http://hg.saddi.com/flup-py3.0/ updated for Python 3.4+ (but please use WSGI!)


Languages

Language:Python 100.0%