python - Paths on DigitalOcean with Flask -


i have flask application on digitalocean creates file(shapefile), , later on reads again. how write paths of file, make sure can read later again?

use paths relative application's root. in flask application object ( app ) has .root_path attribute can use create absolute paths files. like:

with open(os.path.join(app.root_path, 'shapefiles', file_name), 'w') f:     f.write(....) 

and later reverse

with open(os.path.join(app.root_path, 'shapefiles', file_name), 'r') f:     data = f.read(....) 

Comments

Popular posts from this blog

c# - Unity IoC Lifetime per HttpRequest for UserStore -

Change the color of an oval at click in Java AWT -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -