def setUp(self): with patch('floto.s3_setup'): floto.s3_setup.return_value = (Mock(), Mock()) self.app = floto.create_app(TestingConfig) self.db = pymongo.Connection().test
def __init__(self, app): self.app = app def __call__(self, environ, start_response): script_name = environ.get('HTTP_X_SCRIPT_NAME', '') if script_name: environ['SCRIPT_NAME'] = script_name path_info = environ['PATH_INFO'] if path_info.startswith(script_name): environ['PATH_INFO'] = path_info[len(script_name):] scheme = environ.get('HTTP_X_SCHEME', '') if scheme: environ['wsgi.url_scheme'] = scheme return self.app(environ, start_response) from floto import create_app, config application = create_app(config.ProductionConfig()) from werkzeug.contrib.fixers import ProxyFix application.wsgi_app = ProxyFix(application.wsgi_app) application.wsgi_app = ReverseProxied(application.wsgi_app) @application.before_first_request def setup_logging(): application.logger.addHandler(logging.StreamHandler()) application.logger.setLevel(logging.DEBUG) fh = logging.FileHandler('/tmp/floto.log') fh.setLevel(logging.DEBUG) application.logger.addHandler(fh)
#!/usr/bin/env python2.7 from floto import create_app, config app = create_app(config.DevelopmentConfig()) app.run('0.0.0.0', port=5100, debug=True)