flup-py3 fork and updated for Python 3.4+.
Please note that WSGI is the preferable way for Python based web applications.
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
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)
Github Repository: github.com/pquentin/flup-py3