1
votes

i have a problem to use image with static folder path in my page. this is my app.yaml

application: something
version: 1
runtime: python27
api_version: 1
threadsafe: yes

handlers:
- url: /images
  static_dir: static/images

- url: /favicon.ico
  static_files: static/favicon.ico
  upload: static/favicon.ico

- url: .*
  script: main.app

libraries:
- name: webapp2
  version: "2.5.2"
- name: jinja2
  version: latest

I have templates, static/images, controllers (has MainHandler.py) folders and in my root i have main.py and app.yaml files. in my templeate folder i have index.html file that contain:

<div>
    <img src="images/fig1.jpg">
</div>

my problem is when page was loaded i cant see my fig1.jpg picture.

1

1 Answers

3
votes

What is the url of this page? If it looks like a subdirectory, then your using a relative path for your image is not pointing to the images path. Try changing to:

<div>
    <img src="/images/fig1.jpg">
</div>

If using Windows, there is a known bug. See:

Google App Engine: Won't serve static assets with below error:

Try adding mime_type: "image/jpeg" to your image handler, to see if that is the cause.