开发者

Serving simple image with App Engine django patch?

开发者 https://www.devze.com 2022-12-13 05:35 出处:网络
How the heck do i serve a simple img without all that MediaGenerator nonsense, in Django on App Engine?

How the heck do i serve a simple img without all that MediaGenerator nonsense, in Django on App Engine? I am using app 开发者_开发百科engine patch.

I got layout like this:

  • django_app_engine_project_folder
    • my_app

Where should my folder for my media be? In my_app? Or do I put everything in the top media folder?

I want to do something like this in my HTML template...

<img src="/site_media/my_image.jpg" />

Note that /media prefix is already beign used for admin media.


Well it seems that using app.yaml works out:

- url: /my_app/media/
  static_dir: my_app/media

Which allows me to refer to image a.jpg in folder my_app/media with a url like:

<img src="/my_app/media/a.jpg" />
0

精彩评论

暂无评论...
验证码 换一张
取 消