def create_app(debug): if debug: import conf_dev as conf else: import conf_prod as conf logging.info('db conf: %s' % str(conf.db)) logging.info('cache conf: %s' % str(conf.cache)) # init db: db.init(db_type=conf.db['type'], db_schema=conf.db['schema'], \ db_host=conf.db['host'], db_port=conf.db['port'], \ db_user=conf.db['user'], db_password=conf.db['password'], \ use_unicode=True, charset='utf8') # init cache: if conf.cache['type'] == 'redis': host = conf.cache.get('host', 'localhost') cache.client = cache.RedisClient(host) if conf.cache['type'] == 'memcache': host = conf.cache.get('host', 'localhost') cache.client = cache.MemcacheClient(host) scan = ['apps.article', 'apps.wiki', 'apps.website', 'auth', 'admin'] if debug: scan.append('static_handler') return web.WSGIApplication(scan, \ document_root=os.path.dirname(os.path.abspath(__file__)), \ filters=(load_site, load_user, load_i18n), \ template_engine='jinja2', \ DEBUG=debug)
def create_app(): configs = conf.configs debug = configs['debug'] logging.info('starting %s mode...' % ('DEBUG' if debug else 'PROD')) logging.info('db conf: %s' % str(configs['db'])) logging.info('cache conf: %s' % str(configs['cache'])) # init db: db.init(db_type='mysql', db_schema=configs['db']['schema'], \ db_host=configs['db']['host'], \ db_port=configs['db']['port'], \ db_user=configs['db']['user'], \ db_password=configs['db']['password'], \ use_unicode=True, charset='utf8') # init cache: cache.client = cache.MemcacheClient(configs['cache']['host']) scan = [ 'apps.article', 'apps.stpage', 'apps.wiki', 'apps.attachment', 'apps.navigation', 'apps.user', 'apps.comment', 'apps.setting', 'core.manage' ] if debug: scan.append('static_handler') return web.WSGIApplication(scan, \ document_root=os.path.dirname(os.path.abspath(__file__)), \ filters=(load_user, ), \ template_engine='jinja2', \ DEBUG=debug)
def create_app(): db.init(db_type='mysql', db_schema='irunning', db_host='localhost', db_port=3306, db_user='******', db_password='******') return web.WSGIApplication( ('urls', ), document_root=os.path.dirname(os.path.abspath(__file__)), template_engine='jinja2', DEBUG=True)
def create_app(): cache.client = cache.RedisClient('localhost') db.init(db_type = 'mysql', \ db_schema = 'livestreaming', \ db_host = 'localhost', \ db_port = 3306, \ db_user = '******', \ db_password = '******', \ use_unicode = True, \ charset = 'utf8') return web.WSGIApplication(('static_handler', 'auth', 'manage'), \ document_root=os.path.dirname(os.path.abspath(__file__)), \ filters=(load_user, load_i18n), template_engine='jinja2', \ DEBUG=True)
def create_app(): # from conf import dbconf # kwargs = dict([(s, getattr(dbconf, s)) for s in dir(dbconf) if s.startswith('DB_')]) # dbargs = kwargs.pop('DB_ARGS', {}) db.init(db_type='mysql', db_schema='weibo', db_host='localhost', db_port=3306, db_user='******', db_password='') return web.WSGIApplication( ('urls', ), document_root=os.path.dirname(os.path.abspath(__file__)), template_engine='jinja2', DEBUG=True)
def create_app(debug): # init db: db.init(db_type='mysql', db_schema='shici', \ db_host='localhost', db_port=3306, \ db_user='******', db_password='******', \ use_unicode=True, charset='utf8') # init cache: cache.client = cache.MemcacheClient('localhost:11211') scan = ['apis'] if debug: scan.append('static_handler') return web.WSGIApplication(scan, \ document_root=os.path.dirname(os.path.abspath(__file__)), \ template_engine='jinja2', \ filters=(load_user,), \ DEBUG=debug)
def create_app(): return web.WSGIApplication(('urls',), document_root=os.path.dirname(os.path.abspath(__file__)), template_engine='jinja2', DEBUG=True)