Python – Django value error: Missing staticfiles manifest entry for ‘inline.bundle.js’ runserver

Django value error: Missing staticfiles manifest entry for ‘inline.bundle.js’ runserver… here is a solution to the problem.

Django value error: Missing staticfiles manifest entry for ‘inline.bundle.js’ runserver

When I run python manage.py runserver

Then I try to get the following error when I access my website locally:

File "/home/rickus/Documents/softwareProjects/211hospitality/suitsandtables/backend/virtualsuits/local/lib/python2.7/site-packages/django/contrib/ staticfiles/storage.py", line 432, in stored_name
    raise ValueError("Missing staticfiles manifest entry for '%s'" % clean_name)
ValueError: Missing staticfiles manifest entry for 'inline.bundle.js'

My full settings file:

"""
Django settings for suitsandtables project.

Generated by 'django-admin startproject' using Django 1.11.10.

For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""

import os
from decouple import config, Csv
import datetime

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = config('SECRET_KEY')

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = config('DEBUG', default=True, cast=bool)
DEBUG_PROPAGATE_EXCEPTIONS = config('DEBUG_PROPAGATE_EXCEPTIONS', default=True, cast=bool)
BLOCKEMAIL = config('BLOCKEMAIL', default=True, cast=bool)

ALLOWED_HOSTS = config('ALLOWED_HOSTS', cast=Csv())

# send grid email code

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_USE_TLS = config('EMAIL_USE_TLS', default=True, cast=bool)
EMAIL_HOST = config('EMAIL_HOST')
EMAIL_PORT = config('EMAIL_PORT')
EMAIL_HOST_USER = config('EMAIL_HOST_USER')
EMAIL_HOST_PASSWORD = config('EMAIL_HOST_PASSWORD')

# Amazon S3 code

AWS_UPLOAD_BUCKET = config('AWS_UPLOAD_BUCKET')

AWS_UPLOAD_USERNAME = config('AWS_UPLOAD_USERNAME')

AWS_UPLOAD_GROUP = config('AWS_UPLOAD_GROUP')

AWS_UPLOAD_ROOT_URI = config('AWS_UPLOAD_ROOT_URI')

# Google maps geocode api url and key

googlemapsgeocodeurl = config('googlemapsgeocodeurl')
googlemapsgeocodekey = config('googlemapsgeocodekey')
googlemapsembedbaseurl = config('googlemapsembedbaseurl')

#example request https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&key=YOUR_API_KEY

emaillinks = {
    'devroot': 'localhost:4200/',
    'devserverroot': 'http://suitsandtables3.herokuapp.com/',
    'productionroot': 'http://www.suitsandtables.com/',
    'venueuserverify': 'user/venue/validate/',
    'clientuserverify': 'user/client/validate/',
    'suitsuserverify': 'user/suits/validate/',
    'forgotpassword': 'user/forgot-password/validate/'
}
# Application definition

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'whitenoise.runserver_nostatic',
    'django.contrib.staticfiles',
    'rest_framework',
    'storages',
    'venues',
    'suitsandtablessettingsapp',
    'Requestforproposal',
    'rest_framework_jwt',
    'STuser'
]

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',

]

ROOT_URLCONF = 'suitsandtables.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': ['suitsandtables/templates',
                 'stemail/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 = 'suitsandtables.wsgi.application'

AUTH_USER_MODEL = 'STuser.STUser'

# Database
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': config('DBNAME'),
        'USER': config('DBUSER'),
        'PASSWORD': config('DBPASSWORD'),
        'HOST': config('DBHOST'),
        'PORT': config('DBPORT'),
    }
}

#REST Framework
REST_FRAMEWORK = {
    'DEFAULT_AUTHENTICATION_CLASSES':(
        'rest_framework_jwt.authentication.JSONWebTokenAuthentication',
        'rest_framework.authentication.SessionAuthentication',
        'rest_framework.authentication.BasicAuthentication',
    ),
}

#JWT settings

JWT_AUTH = {
    'JWT_ENCODE_HANDLER':
    'rest_framework_jwt.utils.jwt_encode_handler',

'JWT_DECODE_HANDLER':
    'rest_framework_jwt.utils.jwt_decode_handler',

'JWT_PAYLOAD_HANDLER':
    'rest_framework_jwt.utils.jwt_payload_handler',

'JWT_PAYLOAD_GET_USER_ID_HANDLER':
    'rest_framework_jwt.utils.jwt_get_user_id_from_payload_handler',

'JWT_RESPONSE_PAYLOAD_HANDLER':
    'rest_framework_jwt.utils.jwt_response_payload_handler',

'JWT_SECRET_KEY': SECRET_KEY,
    'JWT_GET_USER_SECRET_KEY': None,
    'JWT_PUBLIC_KEY': None,
    'JWT_PRIVATE_KEY': None,
    'JWT_ALGORITHM': 'HS256',
    'JWT_VERIFY': False,
    'JWT_VERIFY_EXPIRATION': False,
    'JWT_LEEWAY': 0,
    'JWT_EXPIRATION_DELTA': datetime.timedelta(seconds=20),
    'JWT_AUDIENCE': None,
    'JWT_ISSUER': None,

'JWT_ALLOW_REFRESH': True,
    'JWT_REFRESH_EXPIRATION_DELTA': datetime.timedelta(days=30),

'JWT_AUTH_HEADER_PREFIX': 'JWT',
    'JWT_AUTH_COOKIE': None,

}

# Password validation
# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-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',
    },
]

# Internationalization
# https://docs.djangoproject.com/en/1.11/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True

#angular distro root
ANGULAR_APP_DIR = os.path.join(BASE_DIR, 'frontend/dist/')
#image distro root
ASSETS_DIR = os.path.join(BASE_DIR, 'frontend/dist/assets/')

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.11/howto/static-files/
#STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
#STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage'
STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATIC_URL = '/static/'

STATICFILES_DIRS = [
    os.path.join(ANGULAR_APP_DIR),
    os.path.join(ASSETS_DIR),

]

What I don’t understand is why this file failed? This is from an Angular 6 project. What is the best way to debug this?

After running collect static, I can see the file in my static file directory, which from other posts is a white noise issue.

I used a traditional static file directory instead of white noise as a test, but the problem persists.

Solution

debug = false and STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' == CRASH

debug = false and STATICFILES_STORAGE = 'whitenoise.storage.CompressedStaticFilesStorage' == 200_ok

Also, make sure to update to Whitenoise v4+ and read the docs !

Related Problems and Solutions