Im creating an API and theres a logo image that was working but suddenly it stop. Show that can not found the image(404) in my request. How i fix it?
Hey @AlexandreModesto, welcome to the forums!
Could you provide a repl link? Like that it’d be easier to help you!
No, normally we need the repl one, but just with your username I found it!
I can’t find why it’s not working, I don’t see a code error, but the thing is the image doesn’t pop up when searched via URL!
yeah, I replace the same image and didnt change, should I send email to support??
No, support is only for errors with Replit. Maybe they could help in the Replit Discord!
alteres.png into the
templates folder. In your
index.html file, you’re attempting to access that image as if it’s in the same directory (folder), and since there is no such image in
templates, you’re getting a
404 error. Alternatively you could do
../alteres.png and not move the image, but I’m not sure that’d work with Flask.
btw just add
/__repl to the repl’s domain to access the code
it didnt change anything ‘-’
Ahh… I figured out the issue, you are not serving the image. Add something like this:
@app.route("/alteres.png") def alteres(): return send_file("templates/alteres.png", mimetype="image/png")
(Don’t forget to add
send_file to the list of things you import from
Then in your HTML file you can just use
awesome, it works
but I dont understand, I never did it before and was working normally…
Frankly, I don’t know anything about Flask, I actually personally dislike Python. All I did was attempt to access the image via URL, and when it gave me a 404 error, I assumed you had to serve it manually and searched up how to do that.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.