Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
6d204bf9
Kaydet (Commit)
6d204bf9
authored
Ara 05, 2008
tarafından
Georg Brandl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#4550: fix 2.x syntax in webservers howto.
üst
50b2b6ee
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
webservers.rst
Doc/howto/webservers.rst
+8
-7
No files found.
Doc/howto/webservers.rst
Dosyayı görüntüle @
6d204bf9
...
@@ -101,10 +101,10 @@ simple CGI program::
...
@@ -101,10 +101,10 @@ simple CGI program::
# enable debugging
# enable debugging
import cgitb; cgitb.enable()
import cgitb; cgitb.enable()
print
"Content-Type: text/plain;charset=utf-8"
print
("Content-Type: text/plain;charset=utf-8")
print
print
()
print
"Hello World!"
print
("Hello World!")
You need to write this code into a file with a ``.py`` or ``.cgi`` extension,
You need to write this code into a file with a ``.py`` or ``.cgi`` extension,
this depends on your web server configuration. Depending on your web server
this depends on your web server configuration. Depending on your web server
...
@@ -278,8 +278,8 @@ following WSGI-application::
...
@@ -278,8 +278,8 @@ following WSGI-application::
#!/usr/bin/env python
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# -*- coding: UTF-8 -*-
from cgi import escape
import sys, os
import sys, os
from cgi import escape
from flup.server.fcgi import WSGIServer
from flup.server.fcgi import WSGIServer
def app(environ, start_response):
def app(environ, start_response):
...
@@ -288,7 +288,8 @@ following WSGI-application::
...
@@ -288,7 +288,8 @@ following WSGI-application::
yield '
<h1>
FastCGI Environment
</h1>
'
yield '
<h1>
FastCGI Environment
</h1>
'
yield '
<table>
'
yield '
<table>
'
for k, v in sorted(environ.items()):
for k, v in sorted(environ.items()):
yield '
<tr><th>
%s
</th><td>
%s
</td></tr>
' % (escape(k), escape(v))
yield '
<tr><th>
{0}
</th><td>
{1}
</td></tr>
'.format(
escape(k), escape(v))
yield '
</table>
'
yield '
</table>
'
WSGIServer(app).run()
WSGIServer(app).run()
...
@@ -476,8 +477,8 @@ placeholders.
...
@@ -476,8 +477,8 @@ placeholders.
Python already includes such simple templates::
Python already includes such simple templates::
# a simple template
# a simple template
template = "
<html><body><h1>
Hello
%s
!
</h1></body></html>
"
template = "
<html><body><h1>
Hello
{who}
!
</h1></body></html>
"
print
template % "Reader"
print
(template.format(who="Reader"))
The Python standard library also includes some more advanced templates usable
The Python standard library also includes some more advanced templates usable
through :class:`string.Template`, but in HTML templates it is needed to use
through :class:`string.Template`, but in HTML templates it is needed to use
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment