Quantcast
Channel: Active questions tagged amazon-ec2 - Stack Overflow
Viewing all articles
Browse latest Browse all 29548

Images open in HTML on localhost but not in ec2 instance

$
0
0

I created a website in flask that runs flawlessly on my localhost (localhost:5000). I then created an Amazon Linux 2 AMI ec2 instance and connected to the instance from my browser. Everything is working except the images which are erroring out (404). See below:

enter image description here

Below is my code in flask. It is the same on my local host (works) and in the ec2 instance (doesnt work).

<img src="{{ url_for('static', filename='profile_pics/Logo.jpg') }}" class="img-fluid" alt="Responsive image">

These are the paths on my localhost to the image file and the html file, respectively:

C:\Users\Justin\11.29 - Pound_Tracker\poundtracker\static\profile_pics\Logo.png
C:\Users\Justin\11.29 - Pound_Tracker\poundtracker\templates\layout.html

In my ec2 instance, the paths are:

/var/www/html/poundtracker/static/profile_pics/Logo.png
/var/www/html/poundtracker/templates/layout.html

Please help me find a solution for this!

Thanks in advance!


Viewing all articles
Browse latest Browse all 29548

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>