I'm trying to read a
with open(url_for("static", filename="blogs.json")) as blog_file:
data = json.load(blog_file)
FileNotFoundError: [Errno 2] No such file or directory: '/static/blogs.json'
You generated a URL path, not a path to the local static folder. Use the
app.static_folder attribute instead:
def renderblog(): filename = os.path.join(app.static_folder, 'blogs.json') with open(filename) as blog_file: data = json.load(blog_file)