Wait - what is Django, and why should I be using it? Well, let me tell you a little bit about it.
Django is a web-framework that implements rapid development in the work process, as it takes much of the work and hassle away from you during development. Or in more official terms, Django is the web framework for perfectionists with deadlines.
Now that you probably like the sound of Django more, let's jump right into the benefits it will give you. It's not just rapid development.
• Admin panel: Ever added something into your database that you regret implementing later? Yeah, me too! But let me tell you that Django offers a nifty little-tool: The admin panel. It basically lets you interact with your database in highly customizable ways, letting you change or delete your data without breaking a sweat! The admin panel will also already be there the moment you create your app in the form of this url:
• Security: Django offers something called a CSRF Token, which basically protects users from Cross Site Forgery. This is when a user clicks on a malicious link, and unknowingly lets the attacker perform an important action on an already logged-in website without their consent (like a bank). Since this sounds scary, this is how you can set it up:
Firstly, your CSRF Middleware should be activated by default the moment you create your Django app, but to use the CSRF token, just use it during a post form, inside of the form element.
• Class-based Views: Django offers something called Class-Based Views, which you can structure yourself; but it also has built-in ones, which is what I'm going to be focusing on. These built-in classes are called Built-in-class-based generic views, and their purpose is to automatize certain patterns we have to repeat during web development, making it less of a tedious task. Some of these Built-In classes include DetailView, which is simply used to provide a context/additional information about an object. Another built-in-class would be ListView, which as the name implies, lets you see a list of objects.
To be able to use them, simply import them into your views:
And use them like this:
• Ease of use: Overall, Django offers a lot of resources that drastically shaves off time during the development process and lets users focus more on the design of the application rather than the actual creation (but Django is also easily scalable!), and it's easiness to pick up and learn is a huge benefit to anyone.
While this is mostly the tip of the iceberg of what Django has to offer, I encourage you to take a look at the tutorial:
And simply:
pip3 install Django






Top comments (0)