配置favicon,其实就是在网站加一个图标,本文演示的做法是将favicon.ico放置在/static/images/路径下
1. 直接url里修改
from django.views.generic.base import RedirectView
favicon_view = RedirectView.as_view(url='/static/images/favicon.ico', permanent=True)
urlpatterns = patterns(
...
url(r'^favicon\.ico$', favicon_view),
...
)
2. 或者在html里面修改
<link rel="shortcut icon" type="image/png" href="{{STATIC_URL}}/images/favicon.ico"/>