本文整理匯總了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'
]