Bläddra i källkod

reverted back to CherryPy server

Keith Newman 10 år sedan
förälder
incheckning
86ddf1fc18

+ 11 - 12
frameworks/Python/cherrypy/app.py

@@ -99,16 +99,15 @@ class CherryPyBenchmark(object):
             worlds.append(world.serialize())
             worlds.append(world.serialize())
         return worlds
         return worlds
 
 
-
-# Register the SQLAlchemy plugin
-DBDRIVER = 'mysql'
-DBHOSTNAME = os.environ.get('DBHOST', 'localhost')  
-DATABASE_URI = '%s://benchmarkdbuser:benchmarkdbpass@%s:3306/hello_world?charset=utf8' % (DBDRIVER, DBHOSTNAME)
-SAEnginePlugin(cherrypy.engine, DATABASE_URI).subscribe()
-
-# Register the SQLAlchemy tool
-
-cherrypy.tools.db = SATool()
-
-if __name__ == '__main__':
+if __name__ == "__main__":
+    # Register the SQLAlchemy plugin
+    from saplugin import SAEnginePlugin
+    DBDRIVER = 'mysql'
+    DBHOSTNAME = os.environ.get('DBHOST', 'localhost')
+    DATABASE_URI = '%s://benchmarkdbuser:benchmarkdbpass@%s:3306/hello_world?charset=utf8' % (DBDRIVER, DBHOSTNAME)
+    SAEnginePlugin(cherrypy.engine, DATABASE_URI).subscribe()
+    
+    # Register the SQLAlchemy tool
+    from satool import SATool
+    cherrypy.tools.db = SATool()
     cherrypy.quickstart(CherryPyBenchmark(), '', {'/': {'tools.db.on': True}})
     cherrypy.quickstart(CherryPyBenchmark(), '', {'/': {'tools.db.on': True}})

+ 0 - 2
frameworks/Python/cherrypy/bash_profile.sh

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

+ 2 - 2
frameworks/Python/cherrypy/benchmark_config

@@ -15,7 +15,7 @@
       "framework": "CherryPy",
       "framework": "CherryPy",
       "language": "Python",
       "language": "Python",
       "orm": "Full",
       "orm": "Full",
-      "platform": "Meinheld",
+      "platform": "CherryPy",
       "webserver": "None",
       "webserver": "None",
       "os": "Linux",
       "os": "Linux",
       "database_os": "Linux",
       "database_os": "Linux",
@@ -36,7 +36,7 @@
       "framework": "CherryPy",
       "framework": "CherryPy",
       "language": "Python",
       "language": "Python",
       "orm": "Full",
       "orm": "Full",
-      "platform": "Meinheld",
+      "platform": "CherryPy",
       "webserver": "None",
       "webserver": "None",
       "os": "Linux",
       "os": "Linux",
       "database_os": "Linux",
       "database_os": "Linux",

+ 0 - 25
frameworks/Python/cherrypy/gunicorn_conf.py

@@ -1,25 +0,0 @@
-import multiprocessing
-import os
-import sys
-
-_is_pypy = hasattr(sys, 'pypy_version_info')
-_is_travis = os.environ.get('TRAVIS') == 'true'
-
-workers = multiprocessing.cpu_count() * 3
-if _is_travis:
-    workers = 2
-
-bind = "127.0.0.1:8080"
-keepalive = 120
-errorlog = '-'
-pidfile = 'gunicorn.pid'
-
-if _is_pypy:
-    worker_class = "tornado"
-else:
-    worker_class = "meinheld.gmeinheld.MeinheldWorker"
-
-    def post_fork(server, worker):
-        # Disalbe access log
-        import meinheld.server
-        meinheld.server.set_access_logger(None)

+ 0 - 5
frameworks/Python/cherrypy/requirements.txt

@@ -2,8 +2,3 @@ cherrypy==3.6.0
 
 
 SQLAlchemy==0.9.9
 SQLAlchemy==0.9.9
 mysqlclient==1.3.6
 mysqlclient==1.3.6
-
-gunicorn==19.3.0
-meinheld==0.5.7
-
-greenlet==0.4.5

+ 1 - 1
frameworks/Python/cherrypy/setup.sh

@@ -1,3 +1,3 @@
 #!/bin/bash
 #!/bin/bash
 
 
-$PY2_GUNICORN app:app -c gunicorn_conf.py --error-logfile log-gun.txt  &
+$PY2 app.py &