Zack Yoshyaro
Zack Yoshyaro

Reputation: 2124

Images working locally, but not working once deployed on Google App Engine?

I have an app.yaml file which looks like this:

application: segmentize
version: 1
runtime: python27
api_version: 1
threadsafe: true

handlers:
- url: /css
  static_dir: css

- url: /img(.*\.(gif|png|jpg))
  static_files: img/\1
  upload: img(.*\.(gif|png|jpg))

- url: /
  script: index.app

skip_files:
- ^(.*/)?app\.yaml
- ^(.*/)?app\.yml
- ^(.*/)?index\.yaml
- ^(.*/)?index\.yml
- ^(.*/)?#.*#
- ^(.*/)?.*~
- ^(.*/)?.*\.py[co]
- ^(.*/)?.*/RCS/.*
- ^(.*/)?\..*
- ^(.*/)?dev
- ^(.*/)?old_ver
- ^(.*/)?resources

The images all display fine locally. However, once deployed, they show as broken.

Images in the html are set as follows:

<img src="/img/welcomeimg.png">

Are the images just not uploading when I deploy? What's causing this? The css folder seems to deploy with no issue.

Upvotes: 1

Views: 252

Answers (1)

Lipis
Lipis

Reputation: 21835

Add the slash in the end of the img in the url and in the upload section:

- url: /img/(.*\.(gif|png|jpg))
  static_files: img/\1
  upload: img/(.*\.(gif|png|jpg))

Upvotes: 2

Related Questions