Report (maybe) changes from Django 2.x to Django 3.x: How to specify static file tag rewriting and HttpResponse Redirect

Background

When I touched Django for the first time in half a year, the version was 3. Update fast! So, when I customized the project I made a long time ago, I got some errors, so it seems to be a change, so it may be useful for those who handle Django, so I will share it.

Environment etc.

Django==2.0.4 Customize the project created in Django==3.0.4 Awareness when building with

Python == 3.6.1 (If it is 3.7, an error will occur. Analysis is required in the future.)

1 The static file handling tag was no longer usable by the old guy

TemplateSyntaxError at /
'staticfiles' is not a registered tag library. Must be one of:

I got the error. Just fix the tag and it will be fixed!

This tag
{% load staticfiles %} 

Fix it like ↓
{% load static %}

2 The specification of the destination of HttpResponseRedirect may have changed.

I got a NoReverseMatch error. I specified the app as shown below + it was fixed with a colon. (I don't know if it's a change, but I'll write it down.)

Things that worked before but didn't work due to an error this time ↓

return HttpResponseRedirect(reverse('my_info'))

Things that moved ↓

return HttpResponseRedirect(reverse('user:my_info'))

Helpful articles

The first thing to check when a No Reverse Match occurs in Django https://qiita.com/Gen6/items/8c5ca882643a4d9aaa01

Recommended Posts

Report (maybe) changes from Django 2.x to Django 3.x: How to specify static file tag rewriting and HttpResponse Redirect
How to pass values to JavaScript variables directly from the [Django] template tag