def init_flask_app(self): super(PushWebApp, self).init_flask_app() # init log logging.setup('push_www') LOG.info('push www run......') # init flask property app = self.flask_app app.secret_key = 'haohaoxuexi,tiantianxiangshang' app.permanent_session_lefttime = timedelta(hours=2) app.static_url_path = '/static' app.template_folder = 'push/www/templates' app.static_folder = 'push/www/static' @app.before_request def before_request(): pass @app.context_processor def default_context_processor(): result = {} result['title'] = 'push admin' result['static_url'] = '/static' result['current_user'] = '******' return result self._setup_web_blueprint()
def init_flask_app(self): super(ManagerWebApp, self).init_flask_app( kwargs = {'static_url_path': '/static'} ) # init log logging.setup('manager-web.') LOG.info('manager web app run.') # init flask property app = self.flask_app app.secret_key = 'haohaoxuexi,tiantianxiangshang.' app.permanent_session_lefttime = timedelta(hours=24) app.template_folder = 'lawrence/www/templates' app.static_folder = 'lawrence/www/static' @app.before_request def before_request(): pass @app.context_processor def default_context_processor(): result = {} result['title'] = 'lawrence admin' result['static_url'] = '/static' result['current_user'] = '******' return result self.setup_blueprint()
def init_app(self): super(TaskProxy, self).init_app() logging.setup("task dispatch proxy.") LOG.info("task dispatch proxy run.") self._init_zk() self._build_listen() self.app_service = AppService()
def init_app(self): super(PushIosApp, self).init_app() # init log logging.setup("ios_pusher") LOG.info("push ios app run.......") # init process pool self.workers = multiprocessing.cpu_count() self.pool = multiprocessing.Pool(self.workers, init_signal_handler)
def init_app(self): super(ApnsFeedback, self).init_app() # init log logging.setup("feedbacker") LOG.info("apns feedback service run.") # init apns self._init_apns() # init db self.pms = PushMsgService()
def init_flask_app(self): super(PushApiApp, self).init_flask_app() # init log logging.setup('push_api') LOG.info('push api run......') # init flask property app = self.flask_app app.secret_key = 'haohaoxuexi,tiantianxiangshang' app.permanent_session_lefttime = timedelta(hours=2) # 指定模板,用于添加healthcheck app.template_folder = 'push/www/templates' self._setup_api_blueprint()
def init_app(self): # init parent class, make oslo take effect super(LawrenceApplication, self).init_app() # init log logging.setup("lawrence instance.") LOG.info("server instance is runing.") # init redis cluster self.redis = RedisOperation() self.redis.connect() # init pool(max value is 50) self.pool = multiprocessing.Pool(4, init_signal_handler) # init socket long connect self.sock_obj = QSocketOperation() host_list = CONF.NODES.nodes proxy_port = CONF.PROXY.proxy_port timeout = 4 self.sock_obj.connect(host_list, proxy_port, timeout)
def init_flask_app(self): super(TestApp, self).init_flask_app() logging.setup('test_www') LOG.info('test www app run.....') app = self.flask_app app.secret_key = 'haohaoxuexi,tiantianxiangshang.' app.permanent_session_lefttime = timedelta(hours=24) app.static_url_path = '/static' # 一定要根据'root_path': '具体路径',来确定templates和static的路径 app.template_folder = 'templates' app.static_folder = 'static' # from pprint import pprint # pprint(app.__dict__) # @app.route('/') # def index(): # return render_template('index.html', page_title='jinlong') import views.index as index app.register_blueprint(index.bp, url_prefix='')
# -*- coding: utf-8 -*- import sys from oslo.config import cfg from osmo.core import log as logging cfg.CONF(sys.argv[1:], project='test', version='1.0', default_config_files=None) CONF = cfg.CONF print CONF.log_dir print '. 代表当前目录' logging.setup('test') LOG = logging.getLogger(__name__) LOG.info('osmo--jinlong.yang new test log')
def run(self): logging.setup('myapp log') LOG.info('myapp run')