Move args parsing to make_app()

So that make_app() function can be used for getting wsgi app.

Change-Id: I127e045163912ebd0f3643402ac7fec0f38ec0d6
This commit is contained in:
Lingxian Kong 2016-08-18 17:20:14 +12:00
parent 6c69d161e9
commit 7af1a72a24
2 changed files with 4 additions and 5 deletions

View File

@ -12,7 +12,6 @@
# implied. # implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import flask import flask
from oslo_config import cfg from oslo_config import cfg
@ -24,7 +23,9 @@ from distil.utils import api
CONF = cfg.CONF CONF = cfg.CONF
def make_app(): def make_app(args=None):
config.parse_args(args, 'distil-api')
app = flask.Flask(__name__) app = flask.Flask(__name__)
@app.route('/', methods=['GET']) @app.route('/', methods=['GET'])

View File

@ -41,9 +41,7 @@ class WritableLogger(object):
def main(): def main():
config.parse_args(sys.argv[1:], 'distil-api') application = app.make_app(sys.argv[1:])
application = app.make_app()
CONF.log_opt_values(LOG, logging.INFO) CONF.log_opt_values(LOG, logging.INFO)
try: try:
wsgi.server(eventlet.listen((CONF.host, CONF.port), backlog=500), wsgi.server(eventlet.listen((CONF.host, CONF.port), backlog=500),