I'm trying to migrate from Django 1.9.7 to Django 1.11.5. I have three different django apps, and they are pretty much the same regarding packages and settings. I have deployed all three of them to a web server and two apps are working without any problems, but third one gives me headache - i get this error all the time:
ValueError at / Missing staticfiles manifest entry for ''
Here are the most relevant settings from settings.py
:
# -*- coding: utf-8 -*-
from settings import *
SECRET_KEY = '***'
SITE_ID = 3
ALLOWED_HOSTS = [
'localhost',
'127.0.0.1',
'.example.com',
'.example.com.',
]
INSTALLED_APPS += (
'storages',
'example',
'example2',
'el_pagination',
'debug_toolbar',
)
ROOT_URLCONF = 'example.urls'
WSGI_APPLICATION = 'example.wsgi.application'
DEFAULT_FROM_EMAIL = 'web@example.com'
MANAGERS = ADMINS
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': '127.0.0.1:11211',
'DEFAULT_MIDDLEWARE_ALIAS': 'default',
'DEFAULT_MIDDLEWARE_SECONDS': '300',
'DEFAULT_MIDDLEWARE_KEY_PREFIX': '',
}
}
PASSWORD_HASHERS = (
'django.contrib.auth.hashers.SHA1PasswordHasher',
)
#AWS_HEADERS = { # see http://developer.yahoo.com/performance/rules.html#expires
# 'Expires': 'Thu, 31 Dec 2099 20:00:00 GMT',
# 'Cache-Control': 'max-age=94608000',
#S }
# AMAZON S3 & CLOUDFRONT SERVING MEDIA FILES
AWS_S3_HOST = 's3.eu-central-1.amazonaws.com'
AWS_STORAGE_BUCKET_NAME = '***'
AWS_CLOUDFRONT_DOMAIN = '***.cloudfront.net'
AWS_ACCESS_KEY_ID = "***"
AWS_SECRET_ACCESS_KEY = "***"
MEDIAFILES_LOCATION = 'example/media'
MEDIA_ROOT = '/%s/' % MEDIAFILES_LOCATION
MEDIA_URL = '//%s/%s/' % (AWS_CLOUDFRONT_DOMAIN, MEDIAFILES_LOCATION)
DEFAULT_FILE_STORAGE = 'example.custom_storages.MediaStorage'
# WHITENOISE SERVING STATIC FILES
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
STATIC_ROOT = os.path.join(BASE_DIR, '***/static/example')
STATIC_URL = '/static/'
I don't know why i'm getting this error because i did nothing different (while deploying) comparing to the other two apps which are working regularly. Settings are almost the same! I've also tried to empty .css files so i could throw away possibility that css files are somewhere pointing to files that doesn't exist, but it didn't help. I've updated all of the packages that my websites are using. This app is working normally under Django 1.9.7, but i can't make it to work under 1.11.5.
EDIT - HOW DID I FIX THIS?
Thanks to @evansd's answer i've managed to find the problem! In one of my templates i've had this code which messed the whole thing up:
{% for num in numbers %}
<li>
<img src="{% static ''%}img/header/{{num}}.jpg" alt="image {{num}}"/>
</li>
{% endfor %}
and i've changed it to:
{% for num in numbers %}
<li>
<img src="{% static 'img/header/'|addstr:num|addstr:'.jpg' %}" alt="image {{num}}">
</li>
{% endfor %}
After this fix everything works well! For custom addstr template tag look this answer.