Gunicorn通过egg在python中直接启动

Gunicorn通过egg在python中直接启动,python,flask,gunicorn,Python,Flask,Gunicorn,我正在使用gunicorn w/wsgi(无粘贴器或django)运行烧瓶。现在我有兴趣为我的应用程序构建一个egg包并直接运行它。当我这样做时,我的应用程序开始启动,但无法初始化 剧本 # note the PYTHONPATH is already set to my .egg, which is confirmed by the output below python setup.py bdist_egg; python -m gunicorn.app.wsgiapp server.dum

我正在使用gunicorn w/wsgi(无粘贴器或django)运行烧瓶。现在我有兴趣为我的应用程序构建一个egg包并直接运行它。当我这样做时,我的应用程序开始启动,但无法初始化

剧本

# note the PYTHONPATH is already set to my .egg, which is confirmed by the output below
python setup.py bdist_egg; python -m gunicorn.app.wsgiapp server.dummy
代码:server/dummy.py

from flask import *
from util.config import setting
import logging
from logging import FileHandler

app = Flask('server.dummy')
app.debug = True

file_handler = FileHandler("/tmp/flask.log")
file_handler.setLevel(logging.INFO)
app.logger.addHandler(file_handler)

mydumbblueprint = Blueprint('mydumbblueprint', __name__)

@mydumbblueprint.route('/')
def whatever():
    return jsonify({'whatever': 'is right!'})

app.register_blueprint(mydumbblueprint)
app.logger.info('loading: %s' % app.name)
以下是输出:

2014-11-06 15:37:19 [64098] [INFO] Starting gunicorn 18.0
2014-11-06 15:37:19 [64098] [INFO] Listening at: http://127.0.0.1:8000 (64098)
2014-11-06 15:37:19 [64098] [INFO] Using worker: sync
2014-11-06 15:37:19 [64101] [INFO] Booting worker with pid: 64101
--------------------------------------------------------------------------------
INFO in dummy [/Volumes/opt/src/dio/distillerizer/server/dummy.py:20]:
loading: server.dummy
--------------------------------------------------------------------------------
Failed to find application: 'server.dummy'
2014-11-06 15:37:20 [64101] [INFO] Worker exiting (pid: 64101)
2014-11-06 15:37:20 [64098] [INFO] Shutting down: Master
2014-11-06 15:37:20 [64098] [INFO] Reason: App failed to load.
我知道Flask文档使用Flask(name)来初始化应用程序,但由于我的服务器代码嵌套在一个包中,至少据我所知,这个包不起作用。是否有办法从package.module X加载代码,但在gunicorn和flask之间使用另一个名称引用