WSGI是Web Service Gateway Interface的缩写。
WSGI标准在PEP(Python Enhancement Proposal)中定义并被许多框架实现,其中包括现广泛使用的django框架。
PythonWeb服务器接口(Python Web Server Gateway Interface,缩写为WSGI)是Python应用程序或框架和Web服务器之间的一种接口,已经被广泛接受, 它已基本达成它的可移植性方面的目标。
"""This is a simple example of running a wsgi application with eventlet. For a more fully-featured server which supports multiple processes, multiple threads, and graceful code reloading, see: http://pypi.python.org/pypi/Spawning/ """ import eventlet from eventlet import wsgi def hello_world(env, start_response): if env[‘PATH_INFO‘] != ‘/‘: start_response(‘404 Not Found‘, [(‘Content-Type‘, ‘text/plain‘)]) return [‘Not Found\r\n‘] start_response(‘200 OK‘, [(‘Content-Type‘, ‘text/plain‘)]) return [‘Hello, World!\r\n‘] wsgi.server(eventlet.listen((‘‘, 8090)), hello_world)
时间: 2024-10-11 01:19:07