Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
422 views
in Technique[技术] by (71.8m points)

Why are some images on my Flask application not visible when uploaded to Heroku but are visible on localhost?

As stated above, I am unable to figure out why some images on the website aren't being rendered.

I have ensured that the url and filename are in lowercase and I have used the correct url syntax i.e ('/static/img/banner/common-banner.png').

I am receiving a 404 NOT FOUND error when I inspect my code but the images are in the directory.

Please note that most of the invisible images have been referenced in a css file and not directly to the html file.

Here's a sample code:

.banner_area .banner_inner {
  position: relative;
  background: url('/static/img/banner/common-banner.png') no-repeat center center;
  background-size: cover;
  background-attachment: fixed;
  width: 100%;
  min-height: 300px;
  z-index: 1;
}
<!--================Home Banner Area =================-->
<section class="banner_area ">
  <div class="banner_inner overlay d-flex align-items-center">
    <div class="container">
      <div class="banner_content text-center">
        <div class="page_link">
          <a>Home</a>
          <a>About Us</a>
        </div>
        <h2>About Us</h2>
      </div>
    </div>
  </div>
</section>
<!--================End Home Banner Area =================-->
question from:https://stackoverflow.com/questions/66058014/why-are-some-images-on-my-flask-application-not-visible-when-uploaded-to-heroku

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

Please log in or register to reply this article.

OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...