I have a Flask JSON API application that would read a file in the code repository and display the data in that file. My application file is as follows:
from flask import Flask, jsonify
from utils import load_data
data = load_data(os.environ.get('DATA_FILE_PATH')) # This would be in data/data.txt for example
app = Flask(__name__)
@app.route('/', methods=['GET'])
def home():
return jsonify(data=data)
When I deploy to Heroku, how can I set the environment variable to point to that particular data file? Locally, I would do
$ export DATA_FILE_PATH=/path/to/repo/data/data.txt
I know I can use the Heroku CLI heroku config:set DATA_FILE_PATH=<path> but I'm not sure how to place that path variable since I don't really know the directory structure on the Heroku deployment.
