Add image to page with static folder

42 views
Skip to first unread message

Mahyar

unread,
Jul 17, 2014, 5:51:29 AM7/17/14
to google-a...@googlegroups.com

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.

David Skinner

unread,
Jul 17, 2014, 3:17:59 PM7/17/14
to google-a...@googlegroups.com
"./images/file.jpg" I think you need the dot.

Vinny P

unread,
Jul 18, 2014, 1:07:40 AM7/18/14
to google-a...@googlegroups.com
On Thu, Jul 17, 2014 at 4:51 AM, Mahyar <mahy...@gmail.com> wrote:
i have a problem to use image with static folder path in my page. this is my app.yaml
I have templates, static/images, controllers (has MainHandler.py) folders and in my root i have main.py and app.yaml files. in my problem is when page was loaded i cant see my fig1.jpg picture.



Just to be clear, the image files are located within the subdirectory /static/images/, correct?

When you try to access the image file, do you see any message in logging? Does it say anything similar to " static file referenced by handler not found "? What path are you using when running the script?
 
 
-----------------
-Vinny P
Technology & Media Consultant
Chicago, IL

App Engine Code Samples: http://www.learntogoogleit.com

David Skinner

unread,
Jul 18, 2014, 3:21:33 PM7/18/14
to google-a...@googlegroups.com
<div>
    
<img src="./images/fig1.jpg">
</div>

David Skinner

unread,
Jul 21, 2014, 3:09:36 PM7/21/14
to google-a...@googlegroups.com

That is where mine are located.

--
You received this message because you are subscribed to a topic in the Google Groups "Google App Engine" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-appengine/x0el308P9OU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-appengi...@googlegroups.com.
To post to this group, send email to google-a...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages