Commits

Young King  committed 381d6ee

fix gunicorn support

  • Participants
  • Parent commits 1d21041

Comments (0)

Files changed (4)

 - ...
 
+0.6.3 (2011-2-26)
+-------------------
+
+- fixed gunicorn support, compact with version gunicorn 0.12.0 and earlier.
+
+0.6.2 (2011-2-26)
+-------------------
+
+- fixed runfcgi use port
+
 0.6.1  (2010-11-18)
 --------------------
 

File docs/conf.py

 
 # General information about the project.
 project = u'Flask-Actions'
-copyright = u'2010, Young King'
+copyright = u'2011, Young King'
 
 # The version info for the project you're documenting, acts as replacement for
 # |version| and |release|, also used in various other places throughout the
 # built documents.
 #
 # The short X.Y version.
-version = '0.6.2'
+version = '0.6.3'
 # The full version, including alpha/beta/rc tags.
-release = '0.6.2'
+release = '0.6.3'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.

File flaskext/actions/server_actions.py

     def action(host=('h','127.0.0.1'),port=('p', 8000),workers=('w',4)):
         """run application use gunicorn http server
         """
-        from gunicorn.arbiter import Arbiter
-        from gunicorn.config import Config
-        app.cfg = Config({'bind': "%s:%d" % (host, port), 'workers': workers})
-        arbiter = Arbiter(app)
-        arbiter.run()
+        from gunicorn import version_info
+        if version_info < (0, 9, 0):
+            from gunicorn.arbiter import Arbiter
+            from gunicorn.config import Config
+            arbiter = Arbiter(Config({'bind': "%s:%d" % (host, int(port)),'workers': 4}), app)
+            arbiter.run()
+        else:
+            from gunicorn.app.base import Application
+            
+            class FlaskApplication(Application):
+                def init(self, parser, opts, args):
+                    return {
+                        'bind': '{0}:{1}'.format(host, port),
+                        'workers': 4
+                    }
+                
+                def load(self):
+                    return app
+            
+            FlaskApplication().run()
     return action
 
 def run_tornado_server(app):
 
 setup(
     name='Flask-Actions',
-    version='0.6.2',
+    version='0.6.3',
     url='http://blog.flyzen.com',
     license='BSD',
     author='Young King',