← Back
Editing: launcher.py
import os import imp class module_cache(dict): def __missing__(self, path): name, ext = os.path.splitext(os.path.split(path)[-1]) if ext in ('.pyc', '.py3c'): mod = imp.load_compiled(name, path) else: mod = imp.load_source(name, path) self[path] = value = getattr(mod, 'application') return value cache = module_cache() def application(environ, start_response): return cache[environ['SCRIPT_FILENAME']](environ, start_response) def launch(): from flup.server.fcgi import WSGIServer WSGIServer(application).run() def launch_fork(): from flup.server.fcgi_fork import WSGIServer WSGIServer(application).run()
Save File
Cancel