コード例 #1
0
def start_webapp(config):
    """Starts the Flask server."""
    app.secret_key = 'super secret key'
    # app.config['SESSION_TYPE'] = 'filesystem'

    # Get config variables

    if "imageryURL" not in config:
        print("[ERROR] Could not find imageryURL in the config file!")

    # Get the imagery URL and access key
    imagery_url = config["imageryURL"]
    access_key = ""

    if "accessKey" in config:
        access_key = config["accessKey"]

    # Create imagery downloader
    global imd
    imd = imagery.ImageryDownloader(imagery_url, access_key)

    global program_config
    program_config = config

    global osm
    init_info = program_config["osmUpload"]
    args = ["api", "username", "password"]
    for arg in args:
        if arg not in init_info:
            print("[ERROR] Config: osmUpload->" + arg + " not found!")
            return "BREAK"

    # initializes the class for interacting with OpenStreetMap's API
    osm = backend.OSM_Interactor(init_info["api"], init_info["username"],
                                 init_info["password"])

    app.debug = True
    app.run()
コード例 #2
0
ファイル: application.py プロジェクト: jmather625/Salus
def get_imd():
    # do imd = get_imd() in all functions
    config = get_program_config()
    return imagery.ImageryDownloader(config['accessKey'])
コード例 #3
0

# run the application.
if __name__ == "__main__":
    config = config_reader.get_config()

    # useless
    application.secret_key = 'super secret key'

    # Get config variables
    access_key = None
    if "accessKey" in config:
        access_key = config["accessKey"]

    # Create imagery downloader
    imd = imagery.ImageryDownloader(access_key)

    program_config = config

    init_info = program_config["osmUpload"]
    args = ["api", "username", "password"]
    for arg in args:
        if arg not in init_info:
            print("[ERROR] Config: osmUpload->" + arg + " not found!")
            raise ValueError()

    # initializes the class for interacting with OpenStreetMap's API
    osm = backend.OSM_Interactor(init_info["api"], init_info["username"],
                                 init_info["password"])

    application.debug = True