I am a newbie django developer and this is the django project i will be deploying. Everything works in development but I am been having issues in production. PS: I am using shared hosting for the deployment.
First, the website loads but images are not showing. I tried using whitenoise but keeps getting the error
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/home/publishm/PUBLISHMYCRAFT/learnwithjdd/index/urls.py", line 12, in <module>
path('favicon.ico', RedirectView.as_view(url=staticfiles_storage.url('images/favicon_io/favicon.ico'))), File "/home/publishm/virtualenv/PUBLISHMYCRAFT/learnwithjdd/3.9/lib/python3.9/site-packages/django/contrib/staticfiles/storage.py",
line 203, in url
return self._url(self.stored_name, name, force)
File "/home/publishm/virtualenv/PUBLISHMYCRAFT/learnwithjdd/3.9/lib/python3.9/site-packages/django/contrib/staticfiles/storage.py", line 182, in _url
hashed_name = hashed_name_func(*args)
File "/home/publishm/virtualenv/PUBLISHMYCRAFT/learnwithjdd/3.9/lib/python3.9/site-packages/django/contrib/staticfiles/storage.py", line 513, in stored_name
raise ValueError(
ValueError: Missing staticfiles manifest entry for 'images/favicon_io/favicon.ico'
part of my urls.py
from . import views
from django.urls import path
from . views import BlogHomeView, BlogDetailsView, AddPostView, EditPostView, DeletePostView, AddCategoryView, DraftsListView, AddDraftPostView, DraftPostDetailsView, EditDraftPostView, DeleteDraftPostView
from django.views.generic.base import RedirectView
from django.contrib.staticfiles.storage import staticfiles_storage
app_name = 'index'
urlpatterns = [
path('favicon.ico', RedirectView.as_view(url=staticfiles_storage.url('favicon.ico')))
]
part of the settings.py
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
"whitenoise.middleware.WhiteNoiseMiddleware",
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
STATIC_URL = '/static/'
STATIC_ROOT = BASE_DIR / "staticfiles"
STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"
I tried using the whitenoise and play around with the path but the static files and the ckeditor are not working. The error disppears and the website loads the the whitenoise is commented but the images files do not show as the static files are not rendered