<s>
The	O
Web	B-Language
Server	I-Language
Gateway	I-Language
Interface	I-Language
(	O
WSGI	B-Language
,	O
pronounced	O
whiskey	O
or	O
)	O
is	O
a	O
simple	O
calling	O
convention	O
for	O
web	B-Application
servers	I-Application
to	O
forward	O
requests	O
to	O
web	B-Application
applications	I-Application
or	O
frameworks	O
written	O
in	O
the	O
Python	B-Language
programming	I-Language
language	I-Language
.	O
</s>
<s>
The	O
current	O
version	O
of	O
WSGI	B-Language
,	O
version	O
1.0.1	O
,	O
is	O
specified	O
in	O
Python	B-Language
Enhancement	O
Proposal	O
(	O
PEP	O
)	O
3333	O
.	O
</s>
<s>
WSGI	B-Language
was	O
originally	O
specified	O
as	O
PEP-333	O
in	O
2003	O
.	O
</s>
<s>
In	O
2003	O
,	O
Python	B-Language
web	B-Application
frameworks	I-Application
were	O
typically	O
written	O
against	O
only	O
CGI	B-Language
,	O
FastCGI	O
,	O
mod_python	O
,	O
or	O
some	O
other	O
custom	O
API	B-Application
of	O
a	O
specific	O
web	B-Application
server	I-Application
.	O
</s>
<s>
Python	B-Language
currently	O
boasts	O
a	O
wide	O
variety	O
of	O
web	B-Application
application	I-Application
frameworks	I-Application
,	O
such	O
as	O
Zope	O
,	O
Quixote	O
,	O
Webware	B-Application
,	O
SkunkWeb	O
,	O
PSO	O
,	O
and	O
Twisted	O
Web	O
--	O
to	O
name	O
just	O
a	O
few	O
.	O
</s>
<s>
This	O
wide	O
variety	O
of	O
choices	O
can	O
be	O
a	O
problem	O
for	O
new	O
Python	B-Language
users	O
,	O
because	O
generally	O
speaking	O
,	O
their	O
choice	O
of	O
web	B-Application
framework	I-Application
will	O
limit	O
their	O
choice	O
of	O
usable	O
web	B-Application
servers	I-Application
,	O
and	O
vice	O
versa	O
...	O
By	O
contrast	O
,	O
although	O
Java	O
has	O
just	O
as	O
many	O
web	B-Application
application	I-Application
frameworks	I-Application
available	O
,	O
Java	O
's	O
"	O
servlet	O
"	O
API	B-Application
makes	O
it	O
possible	O
for	O
applications	O
written	O
with	O
any	O
Java	O
web	B-Application
application	I-Application
framework	I-Application
to	O
run	O
in	O
any	O
web	B-Application
server	I-Application
that	O
supports	O
the	O
servlet	O
API	B-Application
.	O
</s>
<s>
WSGI	B-Language
was	O
thus	O
created	O
as	O
an	O
implementation-neutral	O
interface	B-Application
between	O
web	B-Application
servers	I-Application
and	O
web	B-Application
applications	I-Application
or	O
frameworks	O
to	O
promote	O
common	O
ground	O
for	O
portable	B-Architecture
web	B-Application
application	I-Application
development	I-Application
.	O
</s>
<s>
The	O
WSGI	B-Language
has	O
two	O
sides	O
:	O
</s>
<s>
the	O
server/gateway	O
side	O
.	O
</s>
<s>
This	O
is	O
often	O
running	O
full	O
web	B-Application
server	I-Application
software	O
such	O
as	O
Apache	B-Application
or	O
Nginx	B-Operating_System
,	O
or	O
is	O
a	O
lightweight	O
application	O
server	B-Application
that	O
can	O
communicate	O
with	O
a	O
webserver	B-Application
,	O
such	O
as	O
.	O
</s>
<s>
the	O
application/framework	O
side	O
.	O
</s>
<s>
This	O
is	O
a	O
Python	B-Language
callable	O
,	O
supplied	O
by	O
the	O
Python	B-Language
program	I-Language
or	O
framework	B-Application
.	O
</s>
<s>
Between	O
the	O
server	B-Application
and	O
the	O
application	O
,	O
there	O
may	O
be	O
one	O
or	O
more	O
WSGI	B-Language
middleware	B-General_Concept
components	I-General_Concept
,	O
which	O
implement	O
both	O
sides	O
of	O
the	O
API	B-Application
,	O
typically	O
in	O
Python	B-Language
code	I-Language
.	O
</s>
<s>
WSGI	B-Language
does	O
not	O
specify	O
how	O
the	O
Python	B-Language
interpreter	O
should	O
be	O
started	O
,	O
nor	O
how	O
the	O
application	O
object	O
should	O
be	O
loaded	O
or	O
configured	O
,	O
and	O
different	O
frameworks	O
and	O
webservers	B-Application
achieve	O
this	O
in	O
different	O
ways	O
.	O
</s>
<s>
A	O
WSGI	B-Language
middleware	B-General_Concept
component	O
is	O
a	O
Python	B-Language
callable	O
that	O
is	O
itself	O
a	O
WSGI	B-Language
application	O
,	O
but	O
may	O
handle	O
requests	O
by	O
delegating	O
to	O
other	O
WSGI	B-Language
applications	O
.	O
</s>
<s>
These	O
applications	O
can	O
themselves	O
be	O
WSGI	B-Language
middleware	B-General_Concept
components	I-General_Concept
.	O
</s>
<s>
A	O
middleware	B-General_Concept
component	O
can	O
perform	O
such	O
functions	O
as	O
:	O
</s>
<s>
A	O
WSGI-compatible	O
"	O
Hello	O
,	O
World	O
!	O
"	O
</s>
<s>
application	O
written	O
in	O
Python	B-Language
:	O
</s>
<s>
environ	O
is	O
a	O
dictionary	O
containing	O
CGI	B-Language
environment	O
variables	O
as	O
well	O
as	O
other	O
request	O
parameters	O
and	O
metadata	O
under	O
well-defined	O
keys	O
.	O
</s>
<s>
A	O
full	O
example	O
of	O
a	O
WSGI	B-Language
network	B-Application
server	I-Application
is	O
outside	O
the	O
scope	O
of	O
this	O
article	O
.	O
</s>
<s>
Below	O
is	O
a	O
sketch	O
of	O
how	O
one	O
would	O
call	O
a	O
WSGI	B-Language
application	O
and	O
retrieve	O
its	O
HTTP	O
status	O
line	O
,	O
response	O
headers	O
,	O
and	O
response	O
body	O
,	O
as	O
Python	B-Language
objects	O
.	O
</s>
<s>
Numerous	O
web	B-Application
frameworks	I-Application
support	O
WSGI	B-Language
:	O
</s>
<s>
Paste	B-Language
component	O
WebOb	O
is	O
specifically	O
a	O
WSGI	B-Language
extension	O
.	O
</s>
<s>
It	O
was	O
adopted	O
by	O
the	O
Pylons	B-Operating_System
project	I-Operating_System
.	O
</s>
<s>
Currently	O
wrappers	O
are	O
available	O
for	O
FastCGI	O
,	O
CGI	B-Language
,	O
SCGI	B-Protocol
,	O
AJP	B-Application
(	O
using	O
flup	O
)	O
,	O
twisted.web	B-Language
,	O
Apache	B-Application
(	O
using	O
mod_wsgi	O
or	O
mod_python	O
)	O
,	O
Nginx	B-Operating_System
(	O
using	O
ngx_http_uwsgi_module	O
)	O
,	O
and	O
Microsoft	B-Application
IIS	I-Application
(	O
using	O
WFastCGI	O
,	O
isapi-wsgi	O
,	O
PyISAPIe	O
,	O
or	O
an	O
ASP	B-General_Concept
gateway	O
)	O
.	O
</s>
