本文整理汇总了Python中tutorial.models.DBSession.configure方法的典型用法代码示例。如果您正苦于以下问题:Python DBSession.configure方法的具体用法?Python DBSession.configure怎么用?Python DBSession.configure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tutorial.models.DBSession
的用法示例。
在下文中一共展示了DBSession.configure方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _initTestingDB
# 需要导入模块: from tutorial.models import DBSession [as 别名]
# 或者: from tutorial.models.DBSession import configure [as 别名]
def _initTestingDB():
from tutorial.models import DBSession
from tutorial.models import Base
from sqlalchemy import create_engine
engine = create_engine('sqlite://')
DBSession.configure(bind=engine)
Base.metadata.bind = engine
Base.metadata.create_all(engine)
return DBSession
示例2: _initTestingDB
# 需要导入模块: from tutorial.models import DBSession [as 别名]
# 或者: from tutorial.models.DBSession import configure [as 别名]
def _initTestingDB():
from sqlalchemy import create_engine
from tutorial.models import DBSession, Page, Base
engine = create_engine("sqlite://")
Base.metadata.create_all(engine)
DBSession.configure(bind=engine)
with transaction.manager:
model = Page("FrontPage", "This is the front page")
DBSession.add(model)
return DBSession
示例3: _initTestingDB
# 需要导入模块: from tutorial.models import DBSession [as 别名]
# 或者: from tutorial.models.DBSession import configure [as 别名]
def _initTestingDB():
from sqlalchemy import create_engine
from tutorial.models import (
DBSession,
Page,
Base
)
engine = create_engine('sqlite://')
Base.metadata.create_all(engine)
DBSession.configure(bind=engine)
with transaction.manager:
model = Page(name='FrontPage', data='This is the front page')
DBSession.add(model)
return DBSession
示例4: main
# 需要导入模块: from tutorial.models import DBSession [as 别名]
# 或者: from tutorial.models.DBSession import configure [as 别名]
def main(argv=sys.argv):
if len(argv) != 2:
usage(argv)
config_uri = argv[1]
setup_logging(config_uri)
settings = get_appsettings(config_uri)
engine = engine_from_config(settings, 'sqlalchemy.')
DBSession.configure(bind=engine)
Base.metadata.create_all(engine)
with transaction.manager:
user=User(name='mohsen',lname='jahndideho',tel='0937239304',email='[email protected]',username='jahfdfufddf',password='10772',semat='test')
nameh=Nameh(nnameh='اداری',mnameh='مرخصی',chnameh='درخواست مرخصی از ریاست',manameh='اابباتاا',recive='jh',ersal="jahandide",tarikher="jun",mohlat="feb",jahat="eghdam",peyvast="no",vaseiyat="T")
p=Paygham(mpayam="hello",ersal="jahandide",img="tutorial\images\jahandide.jpg")
pa=payam(mapyam="hello",mopyam="jkjkjk",ersal='jahandide',recive='jahandideh')
g=groups(usr="jahandideh")
e=etela(minfo="hihjgkdsfukfspffsdtffdkjlkl")
erj=moerjah(mer="edgsaaffuuygff'isfdjdf")
DBSession.add(pa)
DBSession.add(g)
DBSession.add(e)
DBSession.add(erj)
DBSession.add(p)
DBSession.add(user)
DBSession.add(nameh)