I am trying to Achieve the simple task of displaying a Local png image on Flask Dev server.
Output: It shows the Alt text.
Running Python in Windows 10 Env (local Server)
Browser: Chrome.
app = Flask(__name__, static_url_path='/static')
@app.route("/trial")
def hello_world():
mydf = pd.DataFrame(np.random.rand(20,5))
plot = mydf.plot(xlabel='TestChart', kind= 'bar',x = 1, y = 2,figsize = (7,3))
fig = plot.get_figure()
fig.savefig("randname.png")
httresp = "<html><body>"
httresp += "<img '{{url_for('static', filename='C:/Users/Uname/Flask/static/randname.png')}}' alt='AltText'>"
When i try to open the Link of File (Complete Path) using Chrome URL it works !
I have tried everything to troubleshoot, Like Checking the element in Chrome, etc. Refreshing the Webpage, Copying the Physical File, and then Again restarting by 'Flask Run'
I tried to use Double Backslash for Path, tried Absolute and Reference Path.
I have also tried the suggestions as given in this StackOverFlow Suggestion
also this One