gpt4 book ai didi

Pythonanywhere,如何使用静态文件?网址?

转载 作者:太空狗 更新时间:2023-10-30 01:59:02 29 4
gpt4 key购买 nike

我对 Pythonanywhere 完全陌生,我不知道为什么静态文件没有加载...这是我存储 css 和图像的路径,即 static/images/wikiLang.png

/static/admin/  /usr/local/lib/python2.7/dist-packages/django/contrib/admin/media    
/static/ /home/saadfast/WikiWorld/static
/media/ /home/saadfast/WikiWorld/media

在客户端,我应该如何使用 URL?

我在 search.html 中做了什么:

<div id="TopheaderImg">
<img src="/home/saadfast/WikiWorld/static/images/wikiLogo.png" width="100px" style="float:middle"/>
<br />
<img src="/home/saadfast/WikiWorld/images/wikipediaLang.png" width="100px" style="float:middle"/>
</div>

为什么图片加载不出来?路径或 URL 应该是什么?

最佳答案

此处为 PythonAnywhere 开发人员:我认为问题在于您在 HTML 中使用的路径。映射

/static/        /home/saadfast/WikiWorld/static  

表示将在目录/home/saadfast/WikiWorld/static 中查找以/static/ 开头的URL。所以这意味着你有

<img src="/home/saadfast/WikiWorld/static/images/wikiLogo.png" width="100px" style="float:middle"/>

你应该有

<img src="/static/images/wikiLogo.png" width="100px" style="float:middle"/>

关于Pythonanywhere,如何使用静态文件?网址?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19592998/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com