Ejemplo n.º 1
0
def main(config_filename=None):
    import optparse

    requests_log = logging.getLogger("requests")
    requests_log.setLevel(logging.WARNING)
    logging.basicConfig(level=logging.DEBUG)

    parser = optparse.OptionParser()
    parser.description = 'Deploy the GBI-Client CouchApp to a CouchDB.'
    parser.add_option('--couchurl', help='url of couchdb', default='http://localhost:5984')
    parser.add_option('--dbname', help='database name')
    parser.add_option('--appname', help='name of couchapp, as in /dbname/_design/appname')
    options, args = parser.parse_args()

    if not options.dbname or not options.appname:
        parser.print_help()
        print >>sys.stderr, '\nERROR: --dbname and --appname required'
        sys.exit(1)

    if config_filename:
        config = GeoBoxConfig.from_file(config_filename)
        if not config:
            sys.exit(1)
        app_state = GeoBoxState(config)
    else:
        app_state = GeoBoxState()

    app = create_app(app_state)
    create_offline_editor(app, options.couchurl, options.dbname, options.appname)
Ejemplo n.º 2
0
def main(config_filename=None):
    import optparse

    requests_log = logging.getLogger("requests")
    requests_log.setLevel(logging.WARNING)
    logging.basicConfig(level=logging.DEBUG)

    parser = optparse.OptionParser()
    parser.description = 'Deploy the GBI-Client CouchApp to a CouchDB.'
    parser.add_option('--couchurl',
                      help='url of couchdb',
                      default='http://localhost:5984')
    parser.add_option('--dbname', help='database name')
    parser.add_option('--appname',
                      help='name of couchapp, as in /dbname/_design/appname')
    options, args = parser.parse_args()

    if not options.dbname or not options.appname:
        parser.print_help()
        print >> sys.stderr, '\nERROR: --dbname and --appname required'
        sys.exit(1)

    if config_filename:
        config = GeoBoxConfig.from_file(config_filename)
        if not config:
            sys.exit(1)
        app_state = GeoBoxState(config)
    else:
        app_state = GeoBoxState()

    app = create_app(app_state)
    create_offline_editor(app, options.couchurl, options.dbname,
                          options.appname)
Ejemplo n.º 3
0
def app_server_thread(app_state):
    """Webserver background thread"""
    from geobox.web import create_app
    from geobox.lib.webserver import WebServerThread

    host = app_state.config.get('app', 'host')
    port = app_state.config.get_int('web', 'port')
    app = create_app(app_state)
    return WebServerThread(host, port, app, logger_name='geobox.web.server')
Ejemplo n.º 4
0
def app_server_thread(app_state):
    """Webserver background thread"""
    from geobox.web import create_app
    from geobox.lib.webserver import WebServerThread

    host = app_state.config.get("app", "host")
    port = app_state.config.get_int("web", "port")
    app = create_app(app_state)
    return WebServerThread(host, port, app, logger_name="geobox.web.server")
Ejemplo n.º 5
0
def app_server_thread(app_state):
    """Webserver background thread"""
    from geobox.web import create_app
    from geobox.lib.webserver import WebServerThread

    host = app_state.config.get('app', 'host')
    port = app_state.config.get_int('web', 'port')
    app = create_app(app_state)
    return WebServerThread(host, port, app, logger_name='geobox.web.server')
Ejemplo n.º 6
0
def webserver_command(config='./geobox.ini'):
    from geobox.config import GeoBoxConfig, GeoBoxState
    config = GeoBoxConfig.from_file(config)
    if not config:
        sys.exit(1)

    app_state = GeoBoxState(config)
    app = create_app(app_state)

    # scriptine removed sub-command from argv,
    # but Flask reloader needs complete sys.argv
    sys.argv[1:1] = ['webserver']
    app.run(port=config.get('web', 'port'))
Ejemplo n.º 7
0
def webserver_command(config='./geobox.ini'):
    from geobox.config import GeoBoxConfig, GeoBoxState
    config = GeoBoxConfig.from_file(config)
    if not config:
        sys.exit(1)

    app_state = GeoBoxState(config)
    app = create_app(app_state)

    # scriptine removed sub-command from argv,
    # but Flask reloader needs complete sys.argv
    sys.argv[1:1] = ['webserver']
    app.run(port=config.get('web', 'port'))