Browse Source

adds plaintext and json for wheezy.web

Keith Newman 10 years ago
parent
commit
07e5616376

+ 24 - 0
frameworks/Python/wheezyweb/README.md

@@ -0,0 +1,24 @@
+# wheezy.web Benchmark Test 
+
+Single file test, [app.py](app.py)
+
+## Description
+
+wheezy.web WSGI web framework (https://pythonhosted.org/wheezy.web/)
+
+### Database
+
+(none at the moment)
+
+### Server
+
+* wheezy.web
+
+## Test URLs
+### JSON Encoding
+
+http://localhost:8080/json
+
+### Plaintext
+
+http://localhost:8080/plaintext

+ 39 - 0
frameworks/Python/wheezyweb/app.py

@@ -0,0 +1,39 @@
+
+from wheezy.http import HTTPResponse
+from wheezy.http import WSGIApplication
+from wheezy.routing import url
+from wheezy.web.handlers import BaseHandler
+from wheezy.web.middleware import bootstrap_defaults
+from wheezy.web.middleware import path_routing_middleware_factory
+
+class JsonHandler(BaseHandler):
+
+  def get(self):
+    return self.json_response({"message": "Hello, world!"})
+
+def plaintext(request):
+  response = HTTPResponse()
+  response.write("Hello, world!")
+  return response
+
+all_urls = [
+  url("plaintext", plaintext, name="plaintext"),
+  url("json", JsonHandler, name="json")
+]
+
+options = {}
+
+main = WSGIApplication(
+  middleware = [
+    bootstrap_defaults(url_mapping=all_urls),
+    path_routing_middleware_factory
+  ],
+  options = options
+)
+
+if __name__ == "__main__":
+  from wsgiref.simple_server import make_server
+  try:
+    make_server("", 8080, main).serve_forever()
+  except KeyboardInterrupt:
+    pass

+ 7 - 0
frameworks/Python/wheezyweb/bash_profile.sh

@@ -0,0 +1,7 @@
+export PY2_ROOT=$IROOT/py2
+export PY2=$PY2_ROOT/bin/python
+export PY2_PIP=$PY2_ROOT/bin/pip
+
+export PY3_ROOT=$IROOT/py3
+export PY3=$PY3_ROOT/bin/python3
+export PY3_PIP=$PY3_ROOT/bin/pip3

+ 41 - 0
frameworks/Python/wheezyweb/benchmark_config

@@ -0,0 +1,41 @@
+{
+  "framework": "wheezyweb",
+  "tests": [{
+    "default": {
+      "setup_file": "setup",
+      "json_url": "/json",
+      "plaintext_url": "/plaintext",
+      "port": 8080,
+      "approach": "Realistic",
+      "classification": "Micro",
+      "database": "None",
+      "framework": "wheezy.web",
+      "language": "Python",
+      "orm": "Raw",
+      "platform": "wheezy.web",
+      "webserver": "None",
+      "os": "Linux",
+      "database_os": "Linux",
+      "display_name": "wheezy.web",
+      "notes": "CPython 2.7"
+    },
+    "py3": {
+      "setup_file": "setup_py3",
+      "json_url": "/json",
+      "plaintext_url": "/plaintext",
+      "port": 8080,
+      "approach": "Realistic",
+      "classification": "Micro",
+      "database": "None",
+      "framework": "wheezy.web",
+      "language": "Python",
+      "orm": "Raw",
+      "platform": "wheezy.web",
+      "webserver": "None",
+      "os": "Linux",
+      "database_os": "Linux",
+      "display_name": "wheezy.web-py3",
+      "notes": "CPython 3.4"
+    }
+  }]
+}

+ 11 - 0
frameworks/Python/wheezyweb/install.sh

@@ -0,0 +1,11 @@
+#!/bin/bash
+
+mkdir -p $IROOT/.pip_cache
+export PIP_DOWNLOAD_CACHE=$IROOT/.pip_cache
+
+fw_depends python2 python3 
+
+$PY2_PIP install --install-option="--prefix=${PY2_ROOT}" -r $TROOT/requirements.txt
+
+$PY3_PIP install --install-option="--prefix=${PY3_ROOT}" -r $TROOT/requirements.txt
+

+ 1 - 0
frameworks/Python/wheezyweb/requirements.txt

@@ -0,0 +1 @@
+wheezy.web==0.1.469

+ 3 - 0
frameworks/Python/wheezyweb/setup.sh

@@ -0,0 +1,3 @@
+#!/bin/bash
+
+$PY2 app.py &

+ 3 - 0
frameworks/Python/wheezyweb/setup_py3.sh

@@ -0,0 +1,3 @@
+#!/bin/bash
+
+$PY3 app.py &