I just installed tailwind css for my project through this link in Django and used it in my templates and there was no problem. But now I realized that the admin panel has a problem and all its static files are not loaded and receive a 404 error.
I also tried
python manage.py collectstatic
command, but I got this message and it didn’t work: 0 static files copied to '...\core\static'
settings.py:
DEBUG = True
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [BASE_DIR / 'templates'],
"APP_DIRS": True,
"OPTIONS": {
"context_processors": [
"django.template.context_processors.debug",
"django.template.context_processors.request",
"django.contrib.auth.context_processors.auth",
"django.contrib.messages.context_processors.messages",
],
},
},
]
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.2/howto/static-files/
STATIC_URL = "static/"
STATIC_ROOT = BASE_DIR / "static"
STATICFILES_DIRS = [BASE_DIR / "staticfiles"]
# Configure compressor
COMPRESS_ROOT = BASE_DIR / 'staticfiles'
COMPRESS_ENABLED = True
STATICFILES_FINDERS = ('compressor.finders.CompressorFinder',)
urls.py:
urlpatterns = [
path("admin/", admin.site.urls),
]
# Serving static and media for development
if settings.DEBUG:
urlpatterns += static(
settings.STATIC_URL, document_root=settings.STATIC_ROOT
)