Browse Source

Merge pull request #9 from sashahart/master

Improvements to WSGI example
TechEmpower 12 years ago
parent
commit
e512984890
2 changed files with 7 additions and 6 deletions
  1. 6 6
      wsgi/hello.py
  2. 1 0
      wsgi/requirements.txt

+ 6 - 6
wsgi/hello.py

@@ -1,14 +1,14 @@
-import simplejson
+import ujson
+
 
 def app(environ, start_response):
     response = {
       "message": "Hello, World!"
     }
-    data = simplejson.dumps(response)
-    status = '200 OK'
+    data = ujson.dumps(response)
     response_headers = [
-        ('Content-type','text/plain'),
+        ('Content-type', 'text/plain'),
         ('Content-Length', str(len(data)))
     ]
-    start_response(status, response_headers)
-    return iter([data])
+    start_response('200 OK', response_headers)
+    return [data]

+ 1 - 0
wsgi/requirements.txt

@@ -0,0 +1 @@
+ujson