def makeService(self, options): """Construct a TCPServer from a factory defined in hello_world """ factory, application = MambaApplicationFactory(settings) factory.sessionFactory = Session httpserver = internet.TCPServer(int(options['port']), factory) httpserver.setName('{} Application'.format(settings.name)) application.addService(httpserver) thread_pool = ThreadPoolService(database.Database.pool) application.addService(thread_pool) if are_we_on_heroku(): application.addService(HerokuService()) return application
def makeService(self, options): """Construct a TCPServer from a factory defined in eblana_app """ factory, application = MambaApplicationFactory(settings) factory.sessionFactory = Session httpserver = internet.TCPServer(int(options['port']), factory) httpserver.setName('{} Application'.format(settings.name)) application.addService(httpserver) thread_pool = ThreadPoolService(database.Database.pool) application.addService(thread_pool) if are_we_on_heroku(): application.addService(HerokuService()) return application
def __init__(self): self.name = 'HerokuService' self.on_heroku = heroku.are_we_on_heroku() self.allowed = config.Application().force_heroku_awake self.ping_task = task.LoopingCall(self.ping)
def test_are_we_on_heroku(self): self.assertFalse(heroku.are_we_on_heroku()) os.environ['PYTHONHOME'] = '/app/.heroku/python' self.assertTrue(heroku.are_we_on_heroku()) del os.environ['PYTHONHOME']