-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
asadiqbal08/ Django Version bump #2343
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2343 +/- ##
==========================================
+ Coverage 88.21% 88.28% +0.07%
==========================================
Files 330 330
Lines 15098 15098
Branches 1702 1703 +1
==========================================
+ Hits 13318 13330 +12
+ Misses 1532 1518 -14
- Partials 248 250 +2
Continue to review full report at Codecov.
|
@asadiqbal08 The Python tests in the CI are failing due to lint errors, can you check? |
@pdpinch After investigating the issue related to test failure, I tried to traced it that was producing the following exception:
So I figured out that we need to bump the As per Django=3.2 release notes --> With automatic AppConfig discovery, default_app_config is no longer needed. So the problem here is that, we could not pinned it like
So that is actually, I guess, blocking me to this upgrade in mitxPro. |
Ok continuing further to this, I have some findings and suggestions to continue over this part. 1- As we had pointed out over the PR for releasing the changes, (That may take time from their side ) meanwhile, we are thinking to filter out the above Django warning 2- For migrating to Django=3.2, We need to upgrade the version of 3- With this wagtail upgrade as mentioned in point#2 from 4- The following migration 0051_new_page_data_migrations run before the wagtail migrations and try to migrate data which causes the following exception. 5- So moving ahead, Should we consider to move this migration logic from the migration file to under some management command ? I am not sure what were the actual reasons to keep this stuff inside the migration files. @pdpinch @arslanashraf7 thoughts ? |
04c7b7d
to
4e8c9c3
Compare
Is this comment in the migration file relevant? It suggests changing the legacy migration to a no-op and adding a new one. |
@pdpinch as a good practise, I think these stuff should not be part of migration files. Maintaining migration files manually is not be good. |
9ce70d7
to
95c9b6f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making the requested changes @asadiqbal08. The warnings seem to be resolved now and I was able to test the app now.
However, I added some minor comments & I'm seeing errors two types of errors with images:
- All the images from the wagtail are not showing on the app pages, the static images work fine.
- Open
/cms
and visitImages
menu or any pages that contain Image field, you will be able to notice errors regardingdjango-redis
.
I believe the errors are related to Image Renditions
which use django-redis
as a storage backend.
Error Logs
nginx_1 | 172.21.0.1 - - [23/Feb/2022:11:50:52 +0000] "GET /cms/pages/34/edit/ HTTP/1.1" 500 644930 "http://xpro.odl.local:8053/cms/pages/29/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36" "-" web_1 | File "/usr/local/lib/python3.7/site-packages/django/template/base.py", line 796, in resolve web_1 | value = self._resolve_lookup(context) web_1 | File "/usr/local/lib/python3.7/site-packages/django/template/base.py", line 858, in _resolve_lookup web_1 | current = current() web_1 | File "/usr/local/lib/python3.7/site-packages/wagtail/admin/edit_handlers.py", line 496, in render_as_object web_1 | 'show_add_comment_button': self.comments_enabled and getattr(self.bound_field.field.widget, 'show_add_comment_button', True), web_1 | File "/usr/local/lib/python3.7/site-packages/django/template/loader.py", line 62, in render_to_string web_1 | return template.render(context, request) web_1 | File "/usr/local/lib/python3.7/site-packages/django/template/backends/django.py", line 61, in render web_1 | return self.template.render(context) web_1 | File "/usr/local/lib/python3.7/site-packages/django/template/base.py", line 170, in render web_1 | return self._render(context) web_1 | File "/usr/local/lib/python3.7/site-packages/django/test/utils.py", line 100, in instrumented_test_render web_1 | return self.nodelist.render(context) web_1 | File "/usr/local/lib/python3.7/site-packages/django/template/base.py", line 938, in render web_1 | bit = node.render_annotated(context) web_1 | File "/usr/local/lib/python3.7/site-packages/django/template/base.py", line 905, in render_annotated web_1 | return self.render(context) web_1 | File "/usr/local/lib/python3.7/site-packages/django/template/loader_tags.py", line 195, in render web_1 | return template.render(context) web_1 | File "/usr/local/lib/python3.7/site-packages/django/template/base.py", line 172, in render web_1 | return self._render(context) web_1 | File "/usr/local/lib/python3.7/site-packages/django/test/utils.py", line 100, in instrumented_test_render web_1 | return self.nodelist.render(context) web_1 | File "/usr/local/lib/python3.7/site-packages/django/template/base.py", line 938, in render web_1 | bit = node.render_annotated(context) web_1 | File "/usr/local/lib/python3.7/site-packages/django/template/base.py", line 905, in render_annotated web_1 | return self.render(context) web_1 | File "/usr/local/lib/python3.7/site-packages/django/template/loader_tags.py", line 53, in render web_1 | result = self.nodelist.render(context) web_1 | File "/usr/local/lib/python3.7/site-packages/django/template/base.py", line 938, in render web_1 | bit = node.render_annotated(context) web_1 | File "/usr/local/lib/python3.7/site-packages/django/template/base.py", line 905, in render_annotated web_1 | return self.render(context) web_1 | File "/usr/local/lib/python3.7/site-packages/django/template/base.py", line 988, in render web_1 | output = self.filter_expression.resolve(context) web_1 | File "/usr/local/lib/python3.7/site-packages/django/template/base.py", line 698, in resolve web_1 | new_obj = func(obj, *arg_vals) web_1 | File "/usr/local/lib/python3.7/site-packages/wagtail/admin/templatetags/wagtailadmin_tags.py", line 261, in render_with_errors web_1 | return bound_field.as_widget() web_1 | File "/usr/local/lib/python3.7/site-packages/django/forms/boundfield.py", line 97, in as_widget web_1 | renderer=self.form.renderer, web_1 | File "/usr/local/lib/python3.7/site-packages/wagtail/core/blocks/base.py", line 518, in render web_1 | return self.render_with_errors(name, value, attrs=attrs, errors=None, renderer=renderer) web_1 | File "/usr/local/lib/python3.7/site-packages/wagtail/core/blocks/base.py", line 500, in render_with_errors web_1 | value_json = json.dumps(self.block_def.get_form_state(value)) web_1 | File "/usr/local/lib/python3.7/site-packages/wagtail/core/blocks/stream_block.py", line 264, in get_form_state web_1 | for child in value web_1 | File "/usr/local/lib/python3.7/site-packages/wagtail/core/blocks/stream_block.py", line 264, in <listcomp> web_1 | for child in value web_1 | File "/usr/local/lib/python3.7/site-packages/wagtail/core/blocks/struct_block.py", line 200, in get_form_state web_1 | for name, val in value.items() web_1 | File "/usr/local/lib/python3.7/site-packages/wagtail/core/blocks/struct_block.py", line 200, in <listcomp> web_1 | for name, val in value.items() web_1 | File "/usr/local/lib/python3.7/site-packages/wagtail/images/blocks.py", line 22, in get_form_state web_1 | value_data = self.widget.get_value_data(value) web_1 | File "/usr/local/lib/python3.7/site-packages/wagtail/images/widgets.py", line 34, in get_value_data web_1 | preview_image = get_rendition_or_not_found(image, 'max-165x165') web_1 | File "/usr/local/lib/python3.7/site-packages/wagtail/images/shortcuts.py", line 13, in get_rendition_or_not_found web_1 | return image.get_rendition(specs) web_1 | File "/usr/local/lib/python3.7/site-packages/wagtail/images/models.py", line 292, in get_rendition web_1 | cached_rendition = cache.get(rendition_cache_key) web_1 | File "/usr/local/lib/python3.7/site-packages/django_redis/cache.py", line 91, in get web_1 | value = self._get(key, default, version, client) web_1 | File "/usr/local/lib/python3.7/site-packages/django_redis/cache.py", line 31, in _decorator web_1 | return method(self, *args, **kwargs) web_1 | File "/usr/local/lib/python3.7/site-packages/django_redis/cache.py", line 98, in _get web_1 | return self.client.get(key, default=default, version=version, client=client) web_1 | File "/usr/local/lib/python3.7/site-packages/django_redis/client/default.py", line 265, in get web_1 | return self.decode(value) web_1 | File "/usr/local/lib/python3.7/site-packages/django_redis/client/default.py", line 432, in decode web_1 | value = self._serializer.loads(value) web_1 | File "/usr/local/lib/python3.7/site-packages/django_redis/serializers/pickle.py", line 27, in loads web_1 | return pickle.loads(value) web_1 | File "/usr/local/lib/python3.7/site-packages/django/db/models/fields/files.py", line 142, in __setstate__ web_1 | self.storage = self.field.storage web_1 | AttributeError: 'ImageFieldFile' object has no attribute 'field'
@@ -44,7 +44,7 @@ ua-parser==0.8.0 | |||
user-agents==2.0 | |||
user-util==0.1.5 | |||
uwsgi | |||
wagtail==2.12.5 | |||
wagtail==2.13.4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should try to take the wagtail to the latest version if possible. If not, we should at least get to the latest for 2.13
which is I think 2.13.5
ATM.
requirements.in
Outdated
@@ -3,14 +3,14 @@ celery==5.2.2 | |||
celery-redbeat==2.0.0 | |||
boto3==1.16.63 | |||
dj-database-url==0.5.0 | |||
django==2.2.26 | |||
django-anymail[mailgun]==6.1.0 | |||
django |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@asadiqbal08 What's your opinion on this?
@arslanashraf7 I tested it again as you suggested in 1-1 call today but strange it is not happening for me. 1- Down all images/containers. |
After looking around much, We figured it out that the above exception that shared by @arslanashraf7 above is getting out due to wagtail image renditions. MitxPro is utilizing the Redis memory cache to hold wagtail images that are prefixed with As we updated the @blarghmatey keeping you in loop here to be sure if an exception raised over some other environment e.g. prod then we may need to delete the Waigtail image renditions ,with prefix
Images that are cached over my local instance: cc: |
@asadiqbal08 The things are looking in good shape now the errors that I mentioned above go away by running
(Maybe this is because I don't have any keys although I have rendition objects). Since I was still seeing the error without running
What are your thoughts on this between using this solution and the above-mentioned redis-cli solution? |
@arslanashraf7 I am thinking to remove renditions only with Prefix cc: @pdpinch @blarghmatey |
@asadiqbal08 I shared the model-based script for Django shell. That uses the Rendition model from wagtail itself and removed the cache/rendition entries. However, I'm still fine if you want to go with the command you mentioned above and it worked, my solution was an alternate approach. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making the requested changes. 👍
@blarghmatey @pdpinch do you have any concerns before merging this PR ? |
Nothing from my side |
Pre-Flight checklist
What are the relevant tickets?
fixes: #2333
How should this be manually tested?
Build the container with latest version bump.
Test the web application behavior specially the Wagtail part.