Engine网站上看到图片

Engine网站上看到图片

本文介绍了无法在Google App Engine网站上看到图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只想在Google App Engine网站上显示图片。
我是Google应用引擎的新手。
我在App.yaml和Main.py
app.yaml中进行了更改:

I Just want to show image on Google app Engine Website.I am new to Google app engine.I made changes in App.yaml and Main.pyapp.yaml looks like :

application: simplegraph-007
version: 1
runtime: python27
api_version: 1
threadsafe: yes

handlers:
- url: /favicon\.ico
 static_files: favicon.ico
 upload: favicon\.ico

- url: /images
 static_dir: static/images
 mime_type: image/png

- url: .*
  script: main.app

 libraries:
 - name: webapp2
  version: "2.5.2"

Main.py看起来像。

Main.py looks like.

import webapp2

class MainHandler(webapp2.RequestHandler):
def get(self):
    self.response.out.write("""<img src = 'D:\download\rel.png/>""")

app = webapp2.WSGIApplication([
('/', MainHandler)
], debug=True)

我还有什么需要改变。
我希望得到帮助。

What else I need to change.I hope to get help.

谢谢

推荐答案

将图像复制到项目中的static / images目录中。在浏览器中,此路径为 / images。

Copy the image to static/images directory in your project. From a browser, this path is "/images".

如果只想显示图像,请在浏览器中转到:

If you just want to show the image, in your browser, go to:http://localhost:8080/images/rel.png

要从云中查看图像,请部署您的应用程序并在以下位置查看该图像:

To see the image from the cloud, deploy your app and see the image at:http://PROJECT_ID.appspot.com/images/rel.png

要在html页面中使用该图像,请使用:

To use that image within an html page, use:

<img src="/images/rel.png" />

这篇关于无法在Google App Engine网站上看到图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 01:10