Пример #1
0
 def setUp(self):
     self.config = testing.setUp()
     engine = create_engine('sqlite://')
     DBSession.configure(bind=engine)
     Base.metadata.create_all(engine)
     with transaction.manager:
         user_id = Setting('user_id', u'69299557@N06')
         user_id.save()
         api_key = Setting('api_key', u'ac8a809ec0883c39965836a9eaf9f04d')
         api_key.save()
Пример #2
0
def main(argv=sys.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:
        index = Page('index', 1, u'Главная', u'Текст о нас')
        about = Page('about', 2, u'О нас', u'Текст о нас')
        contacts = Page('contacts', 5, u'Контакты', u'Текст о контактах')
        partners = Page('partners', 6, u'Партнеры', u'Текст о партнерах')
        projects = Page('projects', 7, u'Дизайн-проект',u'Текст о дизайн-проектах')
        user_id = Setting('user_id', u'')
        api_key = Setting('api_key', u'')
        secret = Setting('secret', u'')
        DBSession.add_all([index, about, contacts, partners,
                           projects, user_id, api_key, secret])

#main()
Пример #3
0
 def tearDown(self):
     DBSession.remove()
     testing.tearDown()