Favicon не загружается как при разработке Django, так и при производстве
Я уже попробовал все доступные решения, как вы можете видеть в коде, но нет помощи. Я могу просмотреть фавикон в браузере, но не на веб-странице
Вы можете увидеть количество попыток
base.html
<link rel="shortcut icon" type="image/png" href="iitiansedu/static/image/favicon.png">
<link rel="shortcut icon" href="{% static 'iitiansedu/static/images/favicon.ico' %}"/>
<link rel="icon" href="{% static 'iitiansedu/images/favicon.png' %}" type="image/x-icon">
<link rel="icon" href="{% static 'iitiansedu/images/favicon.ico' %}">
<link rel="icon" href="{% static 'images/favicon.png' %}">
<link rel="apple-touch-icon" sizes="180x180" href="{% static 'images/apple-touch-icon.png' %}">
<link rel="icon" type="image/png" sizes="32x32" href="{% static 'images/favicon-32x32.png' %}">
<link rel="icon" type="image/png" sizes="16x16" href="{% static 'images/favicon-16x16.png' %}">
<link rel="manifest" href="{% static 'images/site.webmanifest' %}">
<link rel="mask-icon" href="{% static 'images/safari-pinned-tab.svg' %}" color="#5bbad5">
url.py
from django.contrib import admin
from django.urls import path, include
from . import views
from django.conf import settings
from .views import SearchView
from django.contrib.staticfiles.storage import staticfiles_storage
from django.urls import include, path
from django.views.generic.base import RedirectView
from .views import *
from django.templatetags.static import static
from django.conf import settings
from django.conf.urls.static import static
from django.urls import path
from django.contrib import admin
from carousel import views as carousel_views
favicon_view = RedirectView.as_view(url='/static/favicon.ico', permanent=True)
urlpatterns = [
path('admin/', admin.site.urls),
path('', views.HomePage.as_view(), name='home'),
# path('favicon.ico', RedirectView.as_view(url='static/favicon.ico')),
path('favicon.ico', RedirectView.as_view(url=static('favicon.ico'))),
/etc/nginx/sites-enabled
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /home/jagtar/iitiansedu;
}
location / {
include proxy_params;
proxy_pass http://unix:/run/gunicorn.sock;
settings.py
if DEBUG:
STATICFILES_DIRS = [os.path.join(BASE_DIR,'static')]
else:
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATIC_URL = 'static/'
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, "media")