I was reading the Flask documentation recently and found that in Django and Flask, views are both based on functions and classes (called plug-in views in Flask). I don’t quite understand the difference between these two views. Since I have just started, I have always used functional views. What is the difference between these two views? In formal development, are functional views or class-based views used more?
There is no difference, it’s just a different style when writing code.
Class-based views emphasize defining all views in one place,
Function-based views are defined where they are used.
Class-based views facilitate logic reuse. You can write common logic in multiple views in a base class, and the view class that inherits this base class can have this logic.