Loading video player…

Web Frameworks and Django

There are endless web development frameworks out there, so why should you learn Django over any of the others? First of all, it’s written in Python, one of the most readable and beginner-friendly programming languages out there.

The second reason you should learn Django is the scope of its features. If you need to build a website, you don’t need to rely on any external libraries or packages if you choose Django. This means that you don’t need to learn how to use anything else, and the syntax is seamless as you’re using only one framework.

There’s also the added benefit that you don’t need to worry that updating one library or framework will render others that you’ve installed useless. If you do find yourself needing to add extra features, there are a range of external libraries that you can use to enhance your site.

One of the great things about the Django framework is its in-depth documentation. It has detailed documentation on every aspect of Django and also has great examples and even a tutorial to get you started.

There’s also a fantastic community of Django developers, so if you get stuck, there’s almost always a way forward by either checking the docs or asking the community.

Django is a high-level web application framework with loads of features. It’s great for anyone new to web development due to its fantastic documentation, and particularly if you’re also familiar with Python.

00:00 In this video, we’ll talk a bit about web frameworks, in general, and Django, specifically.

00:07 You might be wondering, “Why would you want to use a web framework in the first place?” I’ll take a tiny detour in order to explain why. So, the web is a pretty cool thing, right? And it grew organically.

00:18 It started off with a little seedling of HTML, but then it just kept growing and growing exponentially. And it’s really awesome, but it’s also really a complex mess at this point, so that can be pretty overwhelming and very confusing. Web frameworks are there because they reduce complexity.

00:39 When you’re building for the web using a web framework, there’s a lot of repetitive tasks that you just have to be doing over and over again when you develop for the web that can get abstracted away.

00:50 The web framework helps us with this. There’s some database interactions in web frameworks like Django, for example—we don’t even have to write SQL queries in order to be able to interact with a relational database.

01:02 We can do this in pure Python, and that’s because Django, as a web framework, makes that possible. Web frameworks generally also handle URL requests and URL mapping.

01:11 They provide templating frameworks for us that make it easier to auto-generate HTML pages. They also provide us lots of help with security, caching, sessions, and tons and tons of other things. So as a sum-up, generally web frameworks—if you’re building for the web—they just really make your life a ton easier.

01:32 Next question: why would we want to use Django?

01:36 So, Django is a Python web framework, but it’s by far not the only Python web framework that’s out there. However, we’re using Django for a couple of very good reasons.

01:46 First of all, Django has a fantastic community. The community is large and it’s very supportive. There’s tons of questions and answers on Stack Overflow, the Django documentation is really awesome, and it’s easy to find help.

02:00 Django has been around for more than a decade. It’s time- and battle-tested. Huge applications are out there that have been using Django for a long time and are still using it. It’s really a mature and stable framework.

02:13 Another big reason for using Django is that it comes batteries included, which means that for any starter project that you’re going to build, there’s nothing else that you need to install—you simply use Django.

02:24 That reduces complexity again because you’re not going to have to deal with installing different packages. You can simply stick with Django. Everything has the same syntax and everything is Django-internal.

02:37 If you want to venture outside of that, there’s a huge third-party package ecosystem for Django. People have been developing for Django for more than a decade, and there’s tons of proof of awesome packages out there that you can simply use and install.

02:52 Another thing that’s really great about Django is the pluggable structure. You can create apps in the Django project—we’ll talk about this structure in just a bit—and you can reuse it in a different project, or you can get the project of someone out there on the web and reuse it, or provide your app for someone else to reuse.

03:11 That allows a lot of flexibility and makes development much easier.

03:16 Another thing that I’ve listed here is that we can use the Django ORM for database interactions, abstracting away pure SQL queries. That’s just a couple of examples; there’s much more out there and we’ll touch down on quite a few of those reasons.

03:30 Last but not least, Django is written in Python and, as we all know, Python is an awesome, readable language. It’s fun to write. It has a great community—since you’re here on Real Python, I’m sure you know about this, but why not mention it?

03:44 So, Django is written in Python and Python is a great language. That’s yet another reason for using Django.

Avatar image for mickclark18

mickclark18 on Oct. 10, 2019

Python speaks for itself.

Become a Member to join the conversation.