Support Cloudpulse with WSGI
Change-Id: Ibbe56daa10fa81559bd7b39104f58649be91d3c7
(cherry picked from commit fe39d727d8
)
This commit is contained in:
parent
9ec79f7de8
commit
d4a1da3776
5
cloudpulse.wsgi
Executable file
5
cloudpulse.wsgi
Executable file
@ -0,0 +1,5 @@
|
||||
# With wsgi the default config file will be read from
|
||||
# /docker/cloudpulse/cloudpulse.conf
|
||||
|
||||
from pecan.deploy import deploy
|
||||
application = deploy('/cloudpulse/cloudpulse/config.py')
|
@ -9,12 +9,16 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
import eventlet
|
||||
eventlet.monkey_patch()
|
||||
|
||||
from oslo_config import cfg
|
||||
import pecan
|
||||
import sys
|
||||
|
||||
from cloudpulse.api import auth
|
||||
from cloudpulse.api import config as api_config
|
||||
from cloudpulse.api import hooks
|
||||
from cloudpulse.api import middleware
|
||||
from cloudpulse.common.timerthread import cpulseTimer
|
||||
from cloudpulse.common.timerthread import timerfunc
|
||||
@ -63,11 +67,24 @@ def get_pecan_config():
|
||||
|
||||
|
||||
def setup_app(config=None):
|
||||
# It is recomended to run cloudpulse with the config file
|
||||
# However with wsgi the default config file will be read from
|
||||
# /docker/cloudpulse/cloudpulse.conf
|
||||
if len(sys.argv) == 1:
|
||||
cfg.CONF(["--config-file", "/docker/cloudpulse/cloudpulse.conf"],
|
||||
project='cloudpulse')
|
||||
|
||||
if not config:
|
||||
config = get_pecan_config()
|
||||
|
||||
app_conf = dict(config.app)
|
||||
|
||||
app_conf["hooks"] = [
|
||||
hooks.ContextHook(),
|
||||
hooks.RPCHook(),
|
||||
hooks.NoExceptionTracebackHook(),
|
||||
]
|
||||
|
||||
app = pecan.make_app(
|
||||
app_conf.pop('root'),
|
||||
logging=getattr(config, 'logging', {}),
|
||||
|
@ -31,6 +31,9 @@ app = {
|
||||
'static_root': '%(confdir)s/public',
|
||||
'template_path': '%(confdir)s/api/templates',
|
||||
'debug': True,
|
||||
'acl_public_routes': [
|
||||
'/'
|
||||
],
|
||||
'errors': {
|
||||
404: '/error/404',
|
||||
'__force_dict__': True
|
||||
|
Loading…
Reference in New Issue
Block a user