django -- favicon.ico 配置

[HTML_REMOVED] [HTML_REMOVED][HTML_REMOVED][HTML_REMOVED] [HTML_REMOVED][HTML_REMOVED][HTML_REMOVED] [HTML_REMOVED] [HTML_REMOVED]前言[HTML_REMOVED] [HTML_REMOVED]在使用 django 做测试的时候,在每次相应请求时,都打印一个无用日志[HTML_REMOVED] [HTML_REMOVED][HTML_REMOVED][HTML_REMOVED][HTML_REMOVED]Not Found: /favicon.ico [12/Mar/2018 17:07:40] [HTML_REMOVED]GET /favicon.ico HTTP/1.1[HTML_REMOVED] 404 2339 [HTML_REMOVED][HTML_REMOVED]

[HTML_REMOVED]

[HTML_REMOVED] [HTML_REMOVED]方法[HTML_REMOVED] [HTML_REMOVED] [HTML_REMOVED]原答案:[HTML_REMOVED]https://stackoverflow.com/questions/11173631/django-favicon-ico-in-development[HTML_REMOVED][HTML_REMOVED] [HTML_REMOVED] [HTML_REMOVED] [HTML_REMOVED] [HTML_REMOVED]文件夹及存放文件的位置可以随意,配置的时候对上就行了[HTML_REMOVED] [HTML_REMOVED] [HTML_REMOVED] [HTML_REMOVED]根目录下新建 media,将 ico 图标命名为 favicon.ico 放到此目录下[HTML_REMOVED] [HTML_REMOVED] [HTML_REMOVED] [HTML_REMOVED]website/website/urls.py[HTML_REMOVED] [HTML_REMOVED] [HTML_REMOVED] [HTML_REMOVED][HTML_REMOVED][HTML_REMOVED][HTML_REMOVED][HTML_REMOVED]from[HTML_REMOVED] [HTML_REMOVED]django.conf[HTML_REMOVED] [HTML_REMOVED]import[HTML_REMOVED] [HTML_REMOVED]settings[HTML_REMOVED] [HTML_REMOVED]from[HTML_REMOVED] [HTML_REMOVED]django.conf.urls.static[HTML_REMOVED] [HTML_REMOVED]import[HTML_REMOVED] [HTML_REMOVED]static[HTML_REMOVED] [HTML_REMOVED]……[HTML_REMOVED] [HTML_REMOVED]if[HTML_REMOVED] [HTML_REMOVED]settings[HTML_REMOVED][HTML_REMOVED].[HTML_REMOVED][HTML_REMOVED]DEBUG[HTML_REMOVED][HTML_REMOVED]:[HTML_REMOVED] [HTML_REMOVED]urlpatterns[HTML_REMOVED] [HTML_REMOVED]+=[HTML_REMOVED] [HTML_REMOVED]static[HTML_REMOVED][HTML_REMOVED]([HTML_REMOVED][HTML_REMOVED]r[HTML_REMOVED][HTML_REMOVED][HTML_REMOVED]/favicon.ico[HTML_REMOVED][HTML_REMOVED][HTML_REMOVED],[HTML_REMOVED] [HTML_REMOVED]document_root[HTML_REMOVED][HTML_REMOVED]=[HTML_REMOVED][HTML_REMOVED][HTML_REMOVED]media/favicon.ico[HTML_REMOVED][HTML_REMOVED][HTML_REMOVED])[HTML_REMOVED] [HTML_REMOVED][HTML_REMOVED]

[HTML_REMOVED]

[HTML_REMOVED]