Exemple #1
0
                        required=False)

    args = parser.parse_args()

    # The user may specify a config file, or use the default
    # specified at `BALAIO_SETTINGS_FILE` env var.
    if args.configfile:
        config = utils.Configuration.from_file(args.configfile)
    else:
        config = utils.balaio_config_from_env()

    # Setting up SqlAlchemy engine.
    engine = models.create_engine_from_config(config)

    # Bootstrapping the app and the server.
    app = httpd.main(config, engine)
    listening = config.get('http_server', 'ip')
    port = config.getint('http_server', 'port')
    server = make_server(listening, port, app)

    print "HTTP Server started listening %s on port %s" % (listening, port)
    try:
        server.serve_forever()
    except KeyboardInterrupt:
        sys.exit('HTTP server stopped.')
else:

    # Setting up the application entry point
    # to be used with Chaussette for example.

    config = utils.balaio_config_from_env()
Exemple #2
0
 def testArgs(self, mock_server_ctor):
   mock_server = Mock()
   mock_server_ctor.return_value = mock_server
   httpd.main(['-p', '123', '-C', 'dummy'])
   mock_server_ctor.assert_called_once_with('dummy', 123)
Exemple #3
0
 def testArgs(self, mock_server_ctor):
     mock_server = Mock()
     mock_server_ctor.return_value = mock_server
     httpd.main(['-p', '123', '-C', 'dummy'])
     mock_server_ctor.assert_called_once_with('dummy', 123)
Exemple #4
0
                        required=False)

    args = parser.parse_args()

    # The user may specify a config file, or use the default
    # specified at `BALAIO_SETTINGS_FILE` env var.
    if args.configfile:
        config = utils.Configuration.from_file(args.configfile)
    else:
        config = utils.balaio_config_from_env()

    # Setting up SqlAlchemy engine.
    engine = models.create_engine_from_config(config)

    # Bootstrapping the app and the server.
    app = httpd.main(config, engine)
    listening = config.get('http_server', 'ip')
    port = config.getint('http_server', 'port')
    server = make_server(listening, port, app)

    print "HTTP Server started listening %s on port %s" % (listening, port)
    try:
        server.serve_forever()
    except KeyboardInterrupt:
        sys.exit('HTTP server stopped.')
else:

    # Setting up the application entry point
    # to be used with Chaussette for example.

    config = utils.balaio_config_from_env()