diff --git a/app.py b/app.py index 9e34efb..2226e93 100644 --- a/app.py +++ b/app.py @@ -33,6 +33,7 @@ data_dir = os.path.join(os.path.abspath(''),'data') image_dir = os.path.join('assets/images') +assets_dir = os.path.join('assets') static_image_route = '/static/' # We download each csv and store it in a pd.DataFrame @@ -338,8 +339,9 @@ def convertList_hex2rgba(hex_list): mapCI = go.Figure( data=go.Choropleth( - geojson=os.path.join(data_dir, 'world.geo.json'), + geojson='data/world-geo-json', locations = map_df.ISO3, + featureidkey="properties.ISO_A3", locationmode='geojson-id', z=map_df.carbonIntensity.astype(float), colorscale=myColors['map1'], @@ -2248,10 +2250,13 @@ def fillin_report_text(aggData, data): # Loader IO @app.server.route('/loaderio-1360e50f4009cc7a15a00c7087429524/') def download_loader(): - return send_file('assets/loaderio-1360e50f4009cc7a15a00c7087429524.txt', - mimetype='text/plain', - attachment_filename='loaderio-1360e50f4009cc7a15a00c7087429524.txt', + return send_file(os.path.join(assets_dir, 'loaderio-1360e50f4009cc7a15a00c7087429524.txt'), as_attachment=True) +# world.geo.json +@app.server.route('/data/world-geo-json') +def download_world_geo_json(): + return send_file(os.path.join(data_dir, 'world.geo.json')) + if __name__ == '__main__': # allows app to update when code is changed!