def setUp(self): self.app = create_app(TestConfig) self.app.logger.setLevel(logging.CRITICAL) self.test_client = self.app.test_client() with self.app.app_context(): self.connection = db.engine.connect() self.transaction = self.connection.begin() self.invite = Invite(rsvp_code='TEST', name='Joe Blo') db.session.add(self.invite) db.session.commit() self.invite_id = self.invite.id
#!/usr/bin/env python2.7 import os import sys import logging from ournewballandchain import create_app, ProductionConfig application = create_app(ProductionConfig) from flask import current_app, request @application.before_first_request def setup_logging(): current_app.logger.setLevel(logging.DEBUG) sh = logging.StreamHandler() sh.setLevel(logging.DEBUG) formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') sh.setFormatter(formatter) current_app.logger.addHandler(sh) @application.before_request def log_requests(): application.logger.info("%s - %s", request.method, request.url)
#!/usr/bin/env python from ournewballandchain import create_app, DefaultConfig, ProductionConfig app = create_app(ProductionConfig) app.run(debug=True, host='0.0.0.0')