relengapi_common: db common extension should be always applied as last
cache extension should not be present as default
This commit is contained in:
Родитель
92746e6729
Коммит
92c344e338
|
@ -6,7 +6,7 @@ from __future__ import absolute_import
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from relengapi_common import db, create_app
|
from relengapi_common import db, cache, create_app
|
||||||
|
|
||||||
|
|
||||||
DEBUG = bool(os.environ.get('DEBUG', __name__ == '__main__'))
|
DEBUG = bool(os.environ.get('DEBUG', __name__ == '__main__'))
|
||||||
|
@ -31,7 +31,7 @@ if not os.environ.get('APP_SETTINGS') and \
|
||||||
|
|
||||||
app = create_app(
|
app = create_app(
|
||||||
"relengapi_clobberer",
|
"relengapi_clobberer",
|
||||||
extensions=[db, init_app],
|
extensions=[cache, init_app, db],
|
||||||
debug=DEBUG,
|
debug=DEBUG,
|
||||||
debug_src=HERE,
|
debug_src=HERE,
|
||||||
)
|
)
|
||||||
|
|
|
@ -11,7 +11,7 @@ import sys
|
||||||
|
|
||||||
from flask import Flask, send_from_directory
|
from flask import Flask, send_from_directory
|
||||||
|
|
||||||
from relengapi_common import api, auth, log, cache, cors
|
import relengapi_common
|
||||||
|
|
||||||
__APP = dict()
|
__APP = dict()
|
||||||
|
|
||||||
|
@ -45,9 +45,13 @@ def create_app(name, extensions=[], config=None, debug=False, debug_src=None,
|
||||||
app.jinja_loader = jinja2.loaders.FileSystemLoader(
|
app.jinja_loader = jinja2.loaders.FileSystemLoader(
|
||||||
os.path.join(os.path.dirname(__file__), 'templates'))
|
os.path.join(os.path.dirname(__file__), 'templates'))
|
||||||
|
|
||||||
base_extensions = [log, auth, api, cache]
|
base_extensions = [
|
||||||
|
relengapi_common.log,
|
||||||
|
relengapi_common.auth,
|
||||||
|
relengapi_common.api,
|
||||||
|
]
|
||||||
if app.debug is True:
|
if app.debug is True:
|
||||||
base_extensions.append(cors)
|
base_extensions.append(relengapi_common.cors)
|
||||||
|
|
||||||
for extension in base_extensions + extensions:
|
for extension in base_extensions + extensions:
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче