简体   繁体   English

openshift python应用程序提供图像

[英]openshift python app serve images

i am developing a simple python based site using wsgi.py as the only script right now. 我正在使用wsgi.py作为唯一的脚本来开发一个基于python的简单站点。 I am looking to serve a logo - a png file. 我希望提供徽标-png文件。 Not clear where to deposit the png file and how to refer to it in the html (ie img src). 不清楚在哪里存放png文件以及如何在html中引用它(即img src)。 thanks for pointers. 感谢您的指导。

I use Django on OpenShift and set the STATIC_ROOT to 我在OpenShift上使用Django并将STATIC_ROOT设置为

os.path.join(os.environ.get('OPENSHIFT_REPO_DIR'),'wsgi','static')

This puts all of my static files (css,images, ect.) in ~/app-root/repo/wsgi/static/ 这会将我所有的静态文件(css,图像等)放入〜/ app-root / repo / wsgi / static /

In the HTML I can refer to this directory using /static/ 在HTML中,我可以使用/ static /引用此目录

So to access the css: /static/style.css Or a logo: /static/logo.png 因此,要访问CSS:/static/style.css或徽标:/static/logo.png

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM