def setUp(self): self.app = create_app(**test_config) self.client = self.app.test_client() self.db = db self._ctx = self.app.test_request_context() self._ctx.push() with self.app.app_context(): self.db.create_all() # create test model self.model_name = 'test_model' self.model = Model(self.model_name) # create test user self.user = User(email='*****@*****.**', password='******', name='sup') self.model.register(self.user) self.db.session.add(self.user) self.db.session.add(self.model) self.db.session.commit()
from lib import db, create_app db.create_all(app=create_app())
from lib import create_app application = create_app('production') if __name__ == '__main__': application.run(debug=False)
from lib import create_app app = create_app() if __name__ == '__main__': app.socketio.run(app, host='0.0.0.0', port=5001, debug=True)
from lib import create_app app = create_app() if __name__ == '__main__': app.run(debug=True)