Article Subtitle 1
Why do we love Django?
We here at Magyk Software make use of many languages and frameworks in the production of the applications we build for our clients. There are a multitude of specifications that we take into account from one application to another. In reference to web frameworks, one might think choosing a web framework would be as simple as opting for the one that has the most capabilities or maybe pick the one that works the fastest, which seems like simple reasoning but building a production app is never as simple as that. We have to take into account so many other factors for example the one that most of our clients our most concerned with: “how long will this take to develop?” We believe in picking the right tool for the job, taking everything into account, which brings me to our topic here today: Django.
What is Django? Django is a Python -based free and open-source web framework that follows the model-template-views (MTV) architectural pattern. It is maintained by the Django Software Foundation (DSF). Django Project Site: https://www.djangoproject.com/
What does MTV mean? The MTV (Model Template View) is a software design pattern. It is a collection of three important components Model View and Template. The Model helps to handle database. The View refers to how the data is accessed be it API or in a HTML Template.
Is Django popular? Django has been around since 2005. In that time it has become one of the most popular frameworks in production. According to this site: https://www.similartech.com/categories/framework Django is in use in over 80 thousand websites. You can see examples of sites using django here: https://djangosites.org/
So why do we like Django? In this authors opinion, the thing that makes django great is the ease of use, which means speedy development. In a world where time is money, its easy to see why this makes Django one of the world’s most popular frameworks.
How does Django achieve it’s speedy development process? Django is considered to be a “Batteries Included” framework, meaning it has many features built in as boiler plate ready to utilize after installation, as opposed to other less opinionated frameworks where you are expected to add in the features that you need. There is a tradeoff to consider here, because although there is less overhead with setup for a new project, we lose some functionality that we would have with other frameworks opting instead for the speed of using Django’s built in functionality and modularity. One of the main draws od Django is its ORM.
What is Django ORM? ORM stands for object relational model. This is one of the most powerful aspects of Django. Normally your web app has a frontend consisting of the actual web page, where the user interacts with an app. Most users are not aware that there user data and other static data is warehoused in a database. The user interacts with the frontend of a website, potentially adding and interacting with the database. This interaction is carried out by some “backend” framework, usually a server or API acting as the intermediary between the “frontend” and the database. This is where Django’s ORM comes into play. Normally during development, one would have to diagram out exactly how the database schema will be layed out, than they would populate the dB with data. After you would build out the views for how the data should be arranged for the frontend and than finally you would route the data to and from the frontend through the API. Django’s ORM simplifies the process. By simply creating the fields you need in the frontend, Django takes care of the rest by building the dB, migrating the schema based and creating views for the data in a all in one dB migration process. This is powerful because it essentially automates the database development process for you. This makes Django’s ORM analogous to Henry Fords’ assembly line in the world of car manufacture.
What else does Django do well?
- The framework cleanly separates components such as its database layer and application layer. This means that you can add more robust traffic handling abilities, only where you have a bottleneck as opposed to upgrading all the components saving you money as the traffic to your site increases over time.
- Django is very secure right out of the box. It has built in implementations to secure input handling including cross-site request forgery (CSRF), cross-site scripting (XSS), and SQL injection.
- Admin Panel
- Django comes with a GUI admin panel where you can see and make changes to items in the database for non technical users, acting as a baked content management system.
- Auth comes built in.
- Django has authorization and authentication built in on install ready to use. The developer doesn’t have to concern themselves with how to authenticate users.
Takeaways We have covered what makes Django so powerful as a web framework. Used properly Django can make the development process much easier, and faster, offering solutions to problems right out of the box. Consider your use case thoroughly though, with Django you give up some granular control, but used correctly its hard to beat!