回到顶部

阅读目录

django2 TypeError: RedirectView() received an invalid keyword 're_path'. as_view only accepts arguments that are already attributes of the class.

django2 报错:

TypeError: RedirectView() received an invalid keyword 're_path'. as_view only accepts arguments that are already attributes of the class.

解决办法:

from django.views.generic.base import RedirectView  # favicon.ico


# favicon_view = RedirectView.as_view(re_path='/static/images/zhuo_64x64.ico', permanent=True)  # django 1.11
favicon_view = RedirectView.as_view(url='/static/images/zhuo_64x64.ico', permanent=True)  # django 2.2

 

^_^
请喝咖啡 ×

文章部分资料可能来源于网络,如有侵权请告知删除。谢谢!

前一篇: How to Add a Text Filter to Django Admin(筛选条件自定义输入)
下一篇: 'django.contrib.auth.middleware.AuthenticationMiddleware' must be in MIDDLEWARE in order to use the admin application.
captcha