0

I just updated from Wagtail 2.11.2 to 2.15.1 and Django 2.2.6 to 3.0. Everything works locally but when I deploy and visit the cms I get an internal server error.

The error in django_errors.log is:

Internal Server Error: /cms/
Traceback (most recent call last):
  File "/home/ubuntu/.local/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
    response = get_response(request)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/django/core/handlers/base.py", line 145, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/django/core/handlers/base.py", line 143, in _get_response
    response = response.render()
  File "/home/ubuntu/.local/lib/python3.6/site-packages/django/template/response.py", line 106, in render
    self.content = self.rendered_content
  File "/home/ubuntu/.local/lib/python3.6/site-packages/django/template/response.py", line 83, in rendered_content
    content = template.render(context, self._request)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/django/template/backends/django.py", line 61, in render
    return self.template.render(context)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/django/template/base.py", line 171, in render
    return self._render(context)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/django/test/utils.py", line 96, in instrumented_test_render
    return self.nodelist.render(context)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/django/template/loader_tags.py", line 150, in render
    return compiled_parent._render(context)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/django/test/utils.py", line 96, in instrumented_test_render
    return self.nodelist.render(context)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/django/template/loader_tags.py", line 150, in render
    return compiled_parent._render(context)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/django/test/utils.py", line 96, in instrumented_test_render
    return self.nodelist.render(context)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/django/template/loader_tags.py", line 150, in render
    return compiled_parent._render(context)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/django/test/utils.py", line 96, in instrumented_test_render
    return self.nodelist.render(context)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/django/template/loader_tags.py", line 62, in render
    result = block.nodelist.render(context)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/django/template/library.py", line 192, in render
    output = self.func(*resolved_args, **resolved_kwargs)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/wagtail/admin/templatetags/wagtailadmin_tags.py", line 521, in versioned_static
    return versioned_static_func(path)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/wagtail/admin/staticfiles.py", line 48, in versioned_static
    base_url = static(path)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/django/templatetags/static.py", line 167, in static
    return StaticNode.handle_simple(path)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/django/templatetags/static.py", line 118, in handle_simple
    return staticfiles_storage.url(path)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/django/contrib/staticfiles/storage.py", line 153, in url
    return self._url(self.stored_name, name, force)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/django/contrib/staticfiles/storage.py", line 132, in _url
    hashed_name = hashed_name_func(*args)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/django/contrib/staticfiles/storage.py", line 420, in stored_name
    raise ValueError("Missing staticfiles manifest entry for '%s'" % clean_name)
ValueError: Missing staticfiles manifest entry for 'wagtailadmin/js/vendor/jquery-3.5.1.min.js

We have a deployment pipeline to staging which has run but I've also tried to manually deploy this just to see and they are both the same.

I've also run python3 manage.py collectstatic (also with flags --noinput --clear).

We are using ManifestStaticFilesStorage:

STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage'

I'm looking for any suggestions on this. I'm not really a Python dev, I was just asked to do some updates on this system.

tfantina
  • 788
  • 11
  • 37

2 Answers2

0

I've found that ManifestStaticFilesStorage doesn't always work correctly depending on how the templates are constructed and the static files are referenced. I'd say that your problem is almost certainly being caused by the use of ManifestStaticFilesStorage. Just comment it out, and then restart your server.

If collectstatic doesn't run completely correctly, then ManifestStaticFilesStorage won't have a mapping to every static file, and you'll get a server error with no other helpful information.

Dan Swain
  • 2,910
  • 1
  • 16
  • 36
0

I ended up having to upgrade several packages on the server, I'm doubt this answer will ever be relevant to anyone else but the solution in this particular instance was to run the following commands:

sudo apt-get upgrade python-setuptools
pip install --upgrade cryptography
pip install --upgrade pip
pip install setuptools_rust
python3 -m pip install -U pip setuptools

pip3 install --upgrade -r requirements.txt


python3 manage.py migrate

sudo supervisorctl stop all
sudo supervisorctl start all

tfantina
  • 788
  • 11
  • 37