Browse Source

use cherrypi to add gzip middleware

Daniel Sheffield 1 year ago
parent
commit
49569e425b
3 changed files with 17 additions and 2 deletions
  1. 15 0
      app/rest/cherrypy.py
  2. 1 1
      app/rest/pyapi.py
  3. 1 1
      app/rest/requirements.txt

+ 15 - 0
app/rest/cherrypy.py

@@ -0,0 +1,15 @@
+import cherrypy
+import wsgigzip
+import bottle
+from .pyapi import *
+
+application = wsgigzip.GzipMiddleware(bottle.default_app())
+
+cherrypy.config.update({
+    'server.socket_host': "0.0.0.0",
+    'server.socket_port': 6772,
+})
+
+cherrypy.tree.graft(application, "/")
+cherrypy.engine.start()
+cherrypy.engine.block()

+ 1 - 1
app/rest/pyapi.py

@@ -250,4 +250,4 @@ SELECT query_to_xml_and_xmlschema({inner}, false, false, ''::text)
     response.content_type = 'application/xhtml+xml; charset=utf-8'
     return template("query-to-xml", title="Tags", xml=xml, form=form)
 
-run(host='0.0.0.0', port=6772, server='paste')
+

+ 1 - 1
app/rest/requirements.txt

@@ -1,4 +1,4 @@
 seaborn
 psycopg[binary]
 bottle
-paste
+cherrypy