本文整理汇总了Python中models.dao.Dao.init_db_uri方法的典型用法代码示例。如果您正苦于以下问题:Python Dao.init_db_uri方法的具体用法?Python Dao.init_db_uri怎么用?Python Dao.init_db_uri使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.dao.Dao
的用法示例。
在下文中一共展示了Dao.init_db_uri方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
# 需要导入模块: from models.dao import Dao [as 别名]
# 或者: from models.dao.Dao import init_db_uri [as 别名]
def setUp(self):
"""初始化数据库表结构, 完成数据库session,缓存及redis连接"""
Dao.init_db_uri()
self.session = Dao.session()
Dao.init_table_schema()
self.cache = OPCache()
self.rds = Dao.redis()
self.session.rollback()
示例2: Config
# 需要导入模块: from models.dao import Dao [as 别名]
# 或者: from models.dao.Dao import init_db_uri [as 别名]
login_url='/login/',
)
tornado.web.Application.__init__(self, urls, **settings)
if __name__ == '__main__':
""""""
options.define(name='config', default='dev')
options.define(name='port', default=38001)
options.define(name='process', default=1)
options.define(name='server', default='total')
tornado.options.parse_command_line()
config = Config(options.config)
Dao.init_db_uri(options.config)
# TODO for dev and test
Dao.init_schema()
app = Application()
app.config = options.config
log.info('Starting box api server... Listening port: {}'.format(options.port))
try:
server = HTTPServer(app, xheaders=True)
server.bind(int(options.port))
server.start(num_processes=int(options.process))
tornado.ioloop.IOLoop.instance().start()
except Exception as e:
log.error('box api can not running:\n{}'.format(e), exc_info=True)
tornado.ioloop.IOLoop.instance().stop()
示例3: FunTVSpider
# 需要导入模块: from models.dao import Dao [as 别名]
# 或者: from models.dao.Dao import init_db_uri [as 别名]
from scrapy.selector import Selector
try:
from scrapy.spider import Spider
except ImportError, e:
from scrapy.spider import BaseSpider as Spider
from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor as sle
from models.fun_video import FunVideo, SubFunViedo
from models.dao import Dao
from utils.pinyin import pinyin
Dao.__echo = False
Dao.init_db_uri('rory')
Dao.init_schema()
db_session = Dao.db_session()
class FunTVSpider(CrawlSpider):
"""
风行电视爬取
"""
name = 'fun_cartoon'
allows_domains = ['fun.tv', ]
start_urls = [
'http://www.fun.tv/retrieve/c-e58aa8e6bcab.n-e5bdb1e78987.o-pl.pg-1'
]