如何在我的django应用程序中获得一个图标? [英] How can I get a favicon to show up in my django app?

查看:105
本文介绍了如何在我的django应用程序中获得一个图标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只想在我的 staticfiles 目录中放置一个 favicon.ico ,然后将其显示在我的应用程序。我如何完成这个?

I just want to drop a favicon.ico in my staticfiles directory and then have it show up in my app. How can I accomplish this?

我已经在我的中放置了一个 favicon.ico staticfiles 目录,但它不显示,我在我的日志中看到这个:

I have placed a favicon.ico file in my staticfiles directory, but it doesn't show up and I see this in my log:

127.0.0.1 - - [21/Feb/2014 10:10:53] "GET /favicon.ico HTTP/1.1" 404 -

如果我去 http:// localhost:8000 / static / favicon.ico 我可以看到favicon。

If I go to http://localhost:8000/static/favicon.ico I can see the favicon.

推荐答案

如果你有一个基础或标题模板,包括所有的地方,为什么不包括基本的HTML的图标?

If you have a base or header template that's included everywhere why not include the favicon there with basic HTML?

<link rel="shortcut icon" type="image/png" href="{{STATIC_URL}}/favicon.ico"/>

这篇关于如何在我的django应用程序中获得一个图标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆