3
# Copyright (c) 2013 Mirantis Inc.
5
# Licensed under the Apache License, Version 2.0 (the "License");
6
# you may not use this file except in compliance with the License.
7
# You may obtain a copy of the License at
9
# http://www.apache.org/licenses/LICENSE-2.0
11
# Unless required by applicable law or agreed to in writing, software
12
# distributed under the License is distributed on an "AS IS" BASIS,
13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15
# See the License for the specific language governing permissions and
16
# limitations under the License.
18
from sahara.utils import patches
25
from eventlet import wsgi
29
# If ../sahara/__init__.py exists, add ../ to Python search path, so that
30
# it will override what happens to be installed in /usr/(local/)lib/python...
31
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
34
if os.path.exists(os.path.join(possible_topdir,
37
sys.path.insert(0, possible_topdir)
40
# NOTE(slukjanov): i18n.enable_lazy() must be called before
41
# sahara.utils.i18n._() is called to ensure it has the desired
42
# lazy lookup behavior.
46
import sahara.main as server
47
from sahara.openstack.common import log as logging
50
LOG = logging.getLogger(__name__)
54
server.setup_common(possible_topdir, 'API')
56
app = server.make_app()
58
server.setup_sahara_api('distributed')
60
from oslo.config import cfg
61
wsgi.server(eventlet.listen((cfg.CONF.host, cfg.CONF.port), backlog=500),
62
app, log=logging.WritableLogger(LOG), debug=False)