#!/usr/bin/python # -*- coding: utf-8; tab-width: 4; indent-tabs-mode: nil; -*- # # aggiungiamo la directory corrente al path (se non presente) # import sys wsgilib = '/'.join( __file__.split('/')[:-1] ) if wsgilib not in sys.path: sys.path.insert(0, wsgilib) # # importazione handler # from router import WSGIRouter, WSGISmartRouter # # index: esempio minimo di applicazione WSGI (pagina iniziale) # def index( environ, start_response ): start_response( '200 OK', [('content-type', 'text/html')] ) return [ 'Index was here' ] # # hello: esempio minimo di applicazione WSGI # def hello( environ, start_response ): start_response( '200 OK', [('content-type', 'text/html')] ) return [ 'Simon says: Hello world!' ] # # fallback: mostra tutti i parametri disponibili all'applicazione WSGI # def fallback( environ, start_response ): from pprint import pformat start_response( '200 OK', [('Content-Type', 'text/html')] ) return [ '-- EMBEDDED MODE --' if not environ.get('mod_wsgi.process_group','') else '-- DAEMON MODE --', '
', pformat( environ, width=132 ).replace('\n','