I’m facing an issue while running the collectstatic command in my Django project. The error seems to stem from a missing file referenced in a CSS file. Here’s the output I get when I run:
python manage.py collectstatic --noinput
It shows:
Found another file with the destination path 'vendor\adminlte\css\adminlte.min.css.map'. It will be ignored since only the first encountered file is collected.
...
Post-processing 'vendor\adminlte\css\adminlte.min.css' failed!
whitenoise.storage.MissingFileError: The file 'vendor/adminlte/css/adminlte.min.css.map' could not be found with <whitenoise.storage.CompressedManifestStaticFilesStorage object at 0x...>.
The CSS file 'vendor/adminlte/css/adminlte.min.css' references a file which could not be found:
vendor/adminlte/css/adminlte.min.css.map
full error
>> D:\SERVER\VELTECH_INTRN> python manage.py collectstatic --noinput
>>
Found another file with the destination path 'vendor\adminlte\css\adminlte.min.css.map'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\js\cancel.js'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\js\popup_response.js'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
Post-processing 'vendor\adminlte\css\adminlte.min.css' failed!
Traceback (most recent call last):
File "D:\SERVER\VELTECH_INTRN\manage.py", line 20, in <module>
main()
File "D:\SERVER\VELTECH_INTRN\manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "D:\SERVER\VELTECH_INTRN\venv\Lib\site-packages\django\core\management\__init__.py", line 442, in execute_from_command_line
utility.execute()
File "D:\SERVER\VELTECH_INTRN\venv\Lib\site-packages\django\core\management\__init__.py", line 436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "D:\SERVER\VELTECH_INTRN\venv\Lib\site-packages\django\core\management\base.py", line 412, in run_from_argv
self.execute(*args, **cmd_options)
File "D:\SERVER\VELTECH_INTRN\venv\Lib\site-packages\django\core\management\base.py", line 458, in execute
output = self.handle(*args, **options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\SERVER\VELTECH_INTRN\venv\Lib\site-packages\django\contrib\staticfiles\management\commands\collectstatic.py", line 209, in handle
collected = self.collect()
^^^^^^^^^^^^^^
File "D:\SERVER\VELTECH_INTRN\venv\Lib\site-packages\django\contrib\staticfiles\management\commands\collectstatic.py", line 154, in collect
raise processed
whitenoise.storage.MissingFileError: The file 'vendor/adminlte/css/adminlte.min.css.map' could not be found with <whitenoise.storage.CompressedManifestStaticFilesStorage object at 0x00000150C6AC8A50>.
The CSS file 'vendor\adminlte\css\adminlte.min.css' references a file which could not be found:
vendor/adminlte/css/adminlte.min.css.map
Please check the URL references in this CSS file, particularly any
relative paths which might be pointing to the wrong location.
PS D:\SERVER\VELTECH_INTRN>
Please anyone help me to slove this problem
This is my settings.py
from pathlib import Path
from django.contrib.messages import constants as messages
import os
from decouple import config, Csv
import dj_database_url
from dotenv import load_dotenv
load_dotenv()
# Environment
ENVIRONMENT = os.getenv("DJANGO_ENV", "development")
# Security Settings
SECURE_SSL_REDIRECT = os.getenv("SECURE_SSL_REDIRECT", "False") == "True"
SESSION_COOKIE_SECURE = os.getenv("SESSION_COOKIE_SECURE", "False") == "True"
CSRF_COOKIE_SECURE = os.getenv("CSRF_COOKIE_SECURE", "False") == "True"
SECURE_HSTS_SECONDS = int(os.getenv("SECURE_HSTS_SECONDS", "0"))
SECURE_HSTS_INCLUDE_SUBDOMAINS = True
SECURE_HSTS_PRELOAD = True
# Base directory
BASE_DIR = Path(__file__).resolve().parent.parent
load_dotenv(BASE_DIR / '.env') # ✅ Load the .env file here
# Secret key (replace in production)
SECRET_KEY = os.getenv('SECRET_KEY', 'unsafe-default-key')
# ⚠️ DEBUG OFF for production
DEBUG = os.getenv('DEBUG', 'False').lower() == 'true'
# Allowed hosts
ALLOWED_HOSTS = os.getenv('ALLOWED_HOSTS', '127.0.0.1').split(',')
# Installed apps
INSTALLED_APPS = [
'import_export',
'jazzmin',
'cloudinary',
'cloudinary_storage',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
# Your app
'internship',
]
JAZZMIN_SETTINGS = {
"site_title": "Internship Portal Admin",
"site_header": "VelTech Internship Portal",
"site_brand": "VelTech",
"site_logo": "images/LOGO.png", # Path to your logo in /static/images/
"login_logo": "images/VELTECH.png",
"welcome_sign": "Welcome to VelTech Internship Admin Panel",
"copyright": "VelTech",
# Top menu links
"topmenu_links": [
{"name": "Dashboard", "url": "admin:index", "permissions": ["auth.view_user"]},
{"name": "Company List", "model": "internship.company"},
{"name": "Student List", "model": "internship.student"},
],
# User menu (top right corner)
"usermenu_links": [
{"name": "Support", "url": "https://veltech.edu.in/support", "new_window": True},
],
# Side menu (app ordering)
"order_with_respect_to": ["auth", "internship"],
# App icons
"icons": {
"auth": "fas fa-users-cog",
"auth.user": "fas fa-user",
"auth.group": "fas fa-users",
"internship.company": "fas fa-building",
"internship.student": "fas fa-user-graduate",
},
# Theme and layout options
"show_sidebar": True,
"navigation_expanded": True,
"hide_apps": [],
"hide_models": [],
"changeform_format": "horizontal_tabs", # or "collapsible", "single"
# UI tweaks
"custom_css": "css/admin_custom.css", # Optional
"custom_js": "js/admin_custom.js", # Optional
"use_google_fonts_cdn": True,
"changeform_format_overrides": {
"auth.user": "collapsible",
},
"language_chooser": False,
"hide_models": [
"auth.User",
"auth.Group",
]
}
# Middleware
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',
'internship.middleware.MaintenanceModeMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'internship_portal.urls'
# Templates
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [BASE_DIR / 'templates'], # Optional global 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',
],
},
},
]
WSGI_APPLICATION = 'internship_portal.wsgi.application'
# Database (SQLite for dev)
DATABASES = {
'default': dj_database_url.config(
default=os.environ.get("DATABASE_URL"),
conn_max_age=600,
ssl_require=not DEBUG # Disable SSL in local dev only
)
}
# Password validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Timezone and language
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'Asia/Kolkata'
USE_I18N = True
USE_TZ = True
STATIC_URL = '/static/'
STATICFILES_DIRS = [BASE_DIR / "static"] # Source static files during development
STATIC_ROOT = BASE_DIR / "staticfiles" # Collected static files for production
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
# ✅ Message tags
MESSAGE_TAGS = {
messages.ERROR: 'alert-danger',
messages.SUCCESS: 'alert-success',
messages.INFO: 'alert-info',
messages.WARNING: 'alert-warning',
}
# ✅ Logging (recommended to debug 500 errors in production)
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'console': {
'class': 'logging.StreamHandler',
},
},
'root': {
'handlers': ['console'],
'level': 'ERROR',
},
}
# Primary key config
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
MESSAGE_TAGS = {
messages.ERROR: 'error',
messages.SUCCESS: 'success',
messages.INFO: 'info',
messages.WARNING: 'warning',
}
CLOUDINARY_STORAGE = {
'CLOUD_NAME': os.getenv('CLOUDINARY_CLOUD_NAME'),
'API_KEY': os.getenv('CLOUDINARY_API_KEY'),
'API_SECRET': os.getenv('CLOUDINARY_API_SECRET'),
}
DEFAULT_FILE_STORAGE = 'cloudinary_storage.storage.MediaCloudinaryStorage'
# Email configuration
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = os.getenv('EMAIL_HOST', 'smtp.gmail.com')
EMAIL_PORT = int(os.getenv('EMAIL_PORT', 587))
EMAIL_USE_TLS = True
EMAIL_HOST_USER = os.getenv('EMAIL_HOST_USER')
EMAIL_HOST_PASSWORD = os.getenv('EMAIL_HOST_PASSWORD')
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
ADMIN_EMAIL = os.getenv('ADMIN_EMAIL')