mod_python
에는 서버 구성에 대한 정보를 제공하는 테스트 페이지 스크립트가 있습니다.mod_wsgi의 테스트 페이지
SetHandler mod_python
PythonHandler mod_python.testhandler
을 .htaccess
에 입력하면 해당 페이지가 표시됩니다.
이제 내 질문 : 비슷한 내용이 mod_wsgi
에도 존재합니까? 당신은 종류의 도움이하지만, 싸다의 키를 반복하여 뭔가를 만들 수 있습니다
mod_python
에는 서버 구성에 대한 정보를 제공하는 테스트 페이지 스크립트가 있습니다.mod_wsgi의 테스트 페이지
SetHandler mod_python
PythonHandler mod_python.testhandler
을 .htaccess
에 입력하면 해당 페이지가 표시됩니다.
이제 내 질문 : 비슷한 내용이 mod_wsgi
에도 존재합니까? 당신은 종류의 도움이하지만, 싸다의 키를 반복하여 뭔가를 만들 수 있습니다
번호 :
def application(env, respond):
respond('200 OK', [('Content-Type', 'text/plain')])
return ['\n'.join('%s: %s' % (k, v) for (k, v) in env.iteritems())]
답변 해 주셔서 감사합니다. 한편 이와 같은 솔루션을 찾았지만 좀 더 광범위한 솔루션을 기대했습니다. 'mod_python' 테스트 사이트는 서버와 설정에 관한 일반적인 정보와 같은 추가 정보를 제공합니다. 그러나 환경은 아주 좋은 출발점입니다. – glglgl
나는 지금 여기에 테스트 페이지처럼 뭔가를 함께 넣어했다. 귀하의 편의를 위해 여기에 귀하와 공유하겠습니다 :
def tag(t, **k):
kk = ''.join(' %s=%r' % kv for kv in k.items())
format = '<%s%s>%%s</%s>' % (t, kk, t)
return lambda content: format % content
def table(d):
from cgi import escape
escq = lambda s: escape(s, quote=True)
tr = tag('tr')
th = tag('th')
td_code = lambda content: tag('td')(tag('code')(content))
return tag('table', border='1')(''.join((
'\n\t' + tr(th('Key') + th('Value') + th('Repr')) + '\n',
''.join(('\t' + tr(td_code('%s') + td_code('%s') + td_code('%s')) + '\n') % (k, escq(str(v)), escq(repr(v))) for k, v in sorted(d.items())),
))) + '\n'
def application(environ, start_response):
import os
l = []
from wsgiref.headers import Headers
h = Headers(l)
h.add_header('Content-Type', 'text/html')
start_response('200 OK', l)
yield '<html><head><title>my mod_wsgi test page</title></head><body>\n'
# yield '<h3>General information</h3>\n'
# yield table({})
yield '<h3>Process info</h3>\n'
yield table(dict(
wd=os.getcwd(),
pid=os.getpid(),
ppid=os.getppid(),
uid=os.getuid(),
gid=os.getgid(),
))
yield '<h3>Environment</h3>\n'
yield table(environ)
downvote 및 의견이 없습니다. 고맙습니다. – glglgl