Created
September 22, 2014 07:45
-
-
Save menghan/9a632bbb0acb445f4f3a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import os | |
import sys | |
from flask.ext.script import Command, Option | |
class GunicornServer(Command): | |
"""Run the app within Gunicorn""" | |
def get_options(self): | |
from gunicorn.config import make_settings | |
settings = make_settings() | |
options = ( | |
Option(*klass.cli, action=klass.action) | |
for setting, klass in settings.iteritems() if klass.cli | |
) | |
return options | |
def run(self, *args, **kwargs): | |
run_args = sys.argv[2:] | |
run_args.append('manage:app') | |
os.execvp('gunicorn', [''] + run_args) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is not working in
gunicorn==19.7.1
. In line 12,klass.action
, because of the settingsgunicorn.config.Sendfile
is usingstore_const
which has an extra argumentconst
. Sometimes does not work because of that.The last line of traceback is