mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Tweak some examples.
* Return bytes in Python 3 * Activate wsgiref.validate.validator * Remove unused imports
This commit is contained in:
parent
dddfcb2826
commit
b5d188422e
@ -13,7 +13,7 @@
|
||||
|
||||
def load(arg):
|
||||
def app(environ, start_response):
|
||||
data = 'Hello, %s!\n' % arg
|
||||
data = b'Hello, %s!\n' % arg
|
||||
status = '200 OK'
|
||||
response_headers = [
|
||||
('Content-type', 'text/plain'),
|
||||
|
||||
@ -5,20 +5,15 @@
|
||||
#
|
||||
# Example code from Eventlet sources
|
||||
|
||||
import os
|
||||
import pprint
|
||||
from wsgiref.validate import validator
|
||||
import sys
|
||||
|
||||
from gunicorn import __version__
|
||||
#@validator
|
||||
|
||||
|
||||
@validator
|
||||
def app(environ, start_response):
|
||||
"""Simplest possible application object"""
|
||||
|
||||
errors = environ['wsgi.errors']
|
||||
# pprint.pprint(('ENVIRON', environ), stream=errors)
|
||||
|
||||
print(environ)
|
||||
if environ['REQUEST_METHOD'].upper() != 'POST':
|
||||
data = b'Hello, World!\n'
|
||||
else:
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
|
||||
try:
|
||||
from routes import Mapper
|
||||
except:
|
||||
except ImportError:
|
||||
print("This example requires Routes to be installed")
|
||||
|
||||
# Obviously you'd import your app callables
|
||||
|
||||
@ -8,7 +8,8 @@
|
||||
import os
|
||||
from wsgiref.validate import validator
|
||||
|
||||
#@validator
|
||||
|
||||
@validator
|
||||
def app(environ, start_response):
|
||||
"""Simplest possible application object"""
|
||||
status = '200 OK'
|
||||
|
||||
@ -5,19 +5,15 @@
|
||||
#
|
||||
# Example code from Eventlet sources
|
||||
|
||||
import os
|
||||
import pprint
|
||||
from wsgiref.validate import validator
|
||||
import sys
|
||||
|
||||
from gunicorn import __version__
|
||||
#@validator
|
||||
|
||||
|
||||
@validator
|
||||
def app(environ, start_response):
|
||||
"""Simplest possible application object"""
|
||||
|
||||
errors = environ['wsgi.errors']
|
||||
# pprint.pprint(('ENVIRON', environ), stream=errors)
|
||||
|
||||
data = b'Hello, World!\n'
|
||||
status = '200 OK'
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user