'error while configuring whitenoise with django for eks migration
we are migrating existing django application to kubernetes to load staticfiles we are using whitenoise we have configured all in setting.py file according whitenoise documention but we get 500 error while hitting the /admin page and below are container logs
File "/usr/local/lib/python3.8/site-packages/django/template/base.py", line 905, in render_annotated return self.render(context) File "/usr/local/lib/python3.8/site-packages/django/template/loader_tags.py", line 62, in render result = block.nodelist.render(context) File "/usr/local/lib/python3.8/site-packages/django/template/base.py", line 938, in render bit = node.render_annotated(context) File "/usr/local/lib/python3.8/site-packages/django/template/base.py", line 905, in render_annotated return self.render(context) File "/usr/local/lib/python3.8/site-packages/django/templatetags/static.py", line 106, in render url = self.url(context) File "/usr/local/lib/python3.8/site-packages/django/templatetags/static.py", line 103, in url return self.handle_simple(path) File "/usr/local/lib/python3.8/site-packages/django/templatetags/static.py", line 118, in handle_simple return staticfiles_storage.url(path) File "/usr/local/lib/python3.8/site-packages/django/contrib/staticfiles/storage.py", line 147, in url return self._url(self.stored_name, name, force) File "/usr/local/lib/python3.8/site-packages/django/contrib/staticfiles/storage.py", line 126, in _url hashed_name = hashed_name_func(*args) File "/usr/local/lib/python3.8/site-packages/django/contrib/staticfiles/storage.py", line 417, in stored_name raise ValueError("Missing staticfiles manifest entry for '%s'" % clean_name) ValueError: Missing staticfiles manifest entry for 'admin/css/base.css'
Running python manage.py collectstatic inside the container we get below error
File "manage.py", line 17, in main execute_from_command_line(sys.argv) File "/usr/local/lib/python3.8/site-packages/django/core/management/init.py", line 401, in execute_from_command_line utility.execute() File "/usr/local/lib/python3.8/site-packages/django/core/management/init.py", line 395, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/local/lib/python3.8/site-packages/django/core/management/base.py", line 330, in run_from_argv self.execute(*args, **cmd_options) File "/usr/local/lib/python3.8/site-packages/django/core/management/base.py", line 371, in execute output = self.handle(*args, **options) File "/usr/local/lib/python3.8/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 194, in handle collected = self.collect() File "/usr/local/lib/python3.8/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 138, in collect raise processed whitenoise.storage.MissingFileError: The file 'css/{% static "images/playlist_add.png" %}' could not be found with <whitenoise.storage.CompressedManifestStaticFilesStorage object at >.
The CSS file 'css/style.css' references a file which could not be found: css/{% static "images/playlist_add.png" %}
Please check the URL references in this CSS file, particularly any relative paths which might be pointing to the wrong location.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
