Reputation: 1324
I am getting 500 server error because there seems to be an issue with my static files:
my project folder name is register and I have different setting files for production and development:
register
--live-static
--register
----settings
------__init__.py
-----common.py
-----production.py
-----development.py
--live-static
--static
In my production.py
file I have:
from register.settings.common import *
import django_heroku
django_heroku.settings(locals())
DEBUG = False
STATIC_URL = '/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static')
]
STATIC_ROOT = os.path.join(BASE_DIR, 'live-static', 'static-root')
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'live-static', 'media-root'
I have already ran:
python manage.py collect static
heroku run python manage.py collectstatic
and I got the following result:
1626 static files copied to '/app/live-static/static-root', 4464 post-processed.
However, after I visit my website I get an error:
raise ValueError("Missing staticfiles manifest entry for '%s'" % clean_name)
2020-09-07T19:46:28.324481+00:00 app[web.1]: ValueError: Missing staticfiles manifest entry for 'css/main.css'
in my template I have {% static 'css/main.css' %}
I do not know why i am still getting an error as my collect static has already worked properly. I'd appreciate any help.
Upvotes: 10
Views: 4911
Reputation: 11
It is working on my project. You can apply this solution.
- STATICFILES_STORAGE ="whitenoise.storage.CompressedManifestStaticFilesStorage"
+ STATICFILES_STORAGE = "whitenoise.storage.CompressedStaticFilesStorage"
Upvotes: 1
Reputation: 249
For me these settings worked:
# STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' # try disabling it
WHITENOISE_USE_FINDERS = True
WHITENOISE_MANIFEST_STRICT = False
WHITENOISE_ALLOW_ALL_ORIGINS = True
Upvotes: 2
Reputation: 175
From Whitenoise docs it appears your main.css
may have references to other files:
The most common issue is that there are CSS files which reference other files (usually images or fonts) which don’t exist at that specified path. When Django attempts to rewrite these references it looks for the corresponding file and throws an error if it can’t find it.
I suggest you to change the value of STATICFILES_STORAGE and see if it works:
+ STATICFILES_STORAGE = 'whitenoise.storage.CompressedStaticFilesStorage'
- STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
Upvotes: 15