import os from werkzeug.wsgi import SharedDataMiddleware from wok.server import WokFlask, WokServer from wok.server.proxy import ReverseProxied from wok.server.persona import PersonaLogin from intogensm import VERSION # Flask application ---------------------------------------------------------------------------------------------------- app = WokFlask(__name__) # load configuration conf_path = os.environ["CONF_PATH"] web_conf = ["web.cfg"] if "SM_EXTRA_CONF" in os.environ: names = [c.strip() for c in os.environ["SM_EXTRA_CONF"].split(",")] web_conf += [n if n.endswith(".cfg") else "{}.cfg".format(n) for n in names] web_conf = [os.path.join(conf_path, n) if not os.path.isabs(n) else n for n in web_conf] for cfg in web_conf: app.config.from_pyfile(cfg) # plug middleware apps app.wsgi_app = ReverseProxied(app.wsgi_app) # http://werkzeug.pocoo.org/docs/middlewares/#werkzeug.wsgi.SharedDataMiddleware
# You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses # ############################################################################### import os from datetime import datetime from wok import logger from wok.config.optionsconfig import OptionsConfig from wok.config.data import Data from wok.server import WokFlask, WokServer import home app = WokFlask(__name__) app.register_blueprint(home.bp, url_prefix="/") def main(): conf = OptionsConfig() if "wok" not in conf: print("Missing wok configuration") exit(-1) conf.expand_vars() logger.initialize(conf.get("wok.logging")) log = logger.get_logger("wok.server.start")
import os import time from werkzeug.wsgi import SharedDataMiddleware from wok.server import WokFlask, WokServer from wok.server.proxy import ReverseProxied from wok.server.persona import PersonaLogin from intogensm import VERSION # Flask application ---------------------------------------------------------------------------------------------------- app = WokFlask(__name__) # load app configuration """ The following environment variables can be defined: * WEB_CONF_PATH specifies a base path where configuration files can be found * WEB_CONF_FILES is a ':' separated list of configuration files. The extension can be omitted if it is .cfg. Example: $ export WEB_CONF_PATH=/opt/intogen/conf $ export WEB_CONF_FILES=web:limits This will load: * /opt/intogen/conf/web.cfg