def setUp(self): self.maxDiff = None self.app = acmapi.create_app(SQLALCHEMY_DATABASE_URI='sqlite://') self.app.testing = True with self.app.test_request_context(): DB.create_all() person = Person.create( name = None, username = '******', email = None, website = None, password = '******', ) DB.session.add(person) DB.session.commit() officership = Officership.create( person = person, title = 'Vice Chair', start_date = datetime.date.today(), end_date = None, ) DB.session.add(person) DB.session.add(officership) DB.session.commit()
#!/bin/python2 from acmapi import create_app, DB from acmapi.models import Person, Officership import datetime app = create_app(SQLALCHEMY_DATABASE_URI='sqlite:///') with app.test_request_context(): DB.drop_all() DB.create_all() person = Person.create( name = None, username = '******', email = None, website = None, password = '******', ) DB.session.add(person) DB.session.commit() officership = Officership.create( person = person, title = 'Root', start_date = datetime.date.today(), end_date = None, ) DB.session.add(person) DB.session.add(officership) DB.session.commit()
from acmapi import create_app, DB APP = create_app(None, None, 'SQLALCHEMY_DATABASE_URI') with APP.test_request_context(): DB.create_all() DB.session.commit() if __name__ == '__main__': APP.run(debug=True)