If you are planning to learn a new web framework this year, but still unsure about your choice, this article might help you make up your mind. I will take a look at the Django web framework and try to answer the question: Is it worth learning Django in 2021?
If you want to learn a web development framework, Django is a great choice, it is a highly sought after skill in the job market and also very popular among developers.
To answer the question in more detail, in the following sections I’ll evaluate the Django framework according to the following criteria: learning curve, maturity, the size of the community, popularity trends, number of job opportunities, average salary and future prospects. I’ll also take quick look at the competition: what other web frameworks are out there, that you could also consider picking up.
Number of Django Job Opportunities
To estimate a number of Django Job opportunities compared to other similar web frameworks, I ran a few searches on the stackoverflow job board. Below are the results for the number of open positions in my city (the exact numbers would surely change depending on your location, but the trends are likely somewhat similar):
|Number of Job Posts on StackOverflow|
|Ruby on rails||55|
As you can see Django is in the top 3, only surpassed by Symfony and RoR - but not by much. (Actually seeing RoR on the top surprised me a bit, I thought it to be a bit more niche)
This can give us a rough estimate of where Django is regarding full-time positions, but what about freelance Django developers?
Freelancing Opportunities With Django
To estimate the number of freelancing opportunities I ran the same searches on upwork. Here are my results:
|Number of Gigs on Upwork|
|Ruby on Rails||457|
As you can see Laravel is winning the race by a huge margin, which is not surprising, but Django comes second jumping ahead of express and RoR.
Note: these numbers are not to be compared with the number of full positions in the previous section as these results or not geo-restricted. The number being higher does not suggest that there are more freelancing opportunities than full time positions.
How Much Money Do Django Developers Make
The average salary for Django developer is $76,526 according to glassdoor. They also mark a range from $58k up to $107k yearly.
From my experience freelancers charge anywhere from $20 to $120 hourly, but most of them are in the $30-60 range.
Of course it is much more complicated than that, your salary depends highly on your experience level and geographic location. In entry level positions you can expect to earn somewhere around the lower end of the scale, while senior positions pay much better.
Actually, the tech stack is usually not the main factor regarding your salary, it depends more on the above mentioned parameters: location and experience.
Learning Curve - How Long Does It Take To Learn Django
If you are comfortable with Python and maybe have some previous experience with a modern web framework, then picking up Django should not be too difficult. If you want to know more about Django’s typical learning curve, check out this article.
If you are new to Python, I’d advise against jumping straight into Django. You’ll be much better off if you build strong foundations and learn the basics of Python. If you want to streamline your learning process this post is here to help you out.
How does it compare to other web frameworks? To be honest, Django is not the easiest to get started with. The reason for it is that Django is a very feature-rich system, it comes with all the bells and whistles included: it has it’s own router, MVC system, template engine, ORM layer, database connectors, migration management toolset etc. It also ships with a builtin user authentication and admin scaffolding system. Contrast that with a minimalistic, lightweight framework like Flask, FastApi or express. There is just so much more to learn!
However, do not let that discourage you: Django is a great framework for beginners, as the basics are quite easy to learn, and you can pick up the rest as you go. The advantage of using a fully featured - but admittedly opinionated - framework like Django (or Rails) as a beginner is that it provides you with a basic project structure. If you go with a more bare-bones framework like Flask, you’ll have to figure out on your own how to properly organize the codebase. (This freedom is great when you are more experienced, but can be overwhelming if you are not.)
Documentation, Learning Material
The Django docs or quite good and there is a huge amount of freely accessible learning material both in video and in written format. You can also find a great number of free and paid courses.
The only problem you might face is navigating this overwhelming amount of information, but if you get stuck forums, message boards, Q&A sites like reddit or stackoverflow will surely help you out.
As a last resort you can always consult the source code, as it is freely accessible on github.
The Size of The Django Community
Django has a huge user base and a very healthy developer community. It is in active development, with regular new releases.
The Django Ecosystem
As I mentioned before, the Django community is very active, there are a huge number of 3rd party packages: a quick search on PyPi lists more than 10000 django-related projects.
It also helps that Django’s been around since 2006, so it has an extensive, stable, mature software ecosystem.
Trends - Django’s Popularity Over Time
What does the future hold for Django? Is it a dying framework, is it still going to be around a few years from here?
As you can see Django’s popularity has been quite stable over the last ten years, in fact it is slowly, but steadily rising. This indicates that it is not just a hype, it is safe to say that Django is here to stay for a long-long time. Learning Django seems to be a good long-time investment.
(I wonder what was that curious spike in January 2013 though - if anybody knows what happened there please let me know)
What’s The Future Of Django?
Strong community, constant updates, established user base and positive trends. I’d say the future is bright, although there are some upcoming competitors like Flask, that are gaining popularity, so it might be a good idea to keep an eye on them.
In reality, Flask and the other similar lightweight web frameworks are not really direct competitors of Django. They are great for quickly spinning up a microservice with a simple API, but they do not have all the builtin extra functionality that Django offers. In that regard Django is really one-of-a-kind among the Python-based frameworks.
So far we’ve mostly talked about trends and career opportunities, but we did not really touch on technical things like architecture, performance or security. Let’s fix this, and have a quick overview
Django uses a variation of the MVC architecture, though the naming conventions are a bit different. Django views play a similar role to that of the controllers in MVC, while templates are the rough equivalent of MVC’s views.
It provides an extremely powerful and flexible ORM layer - you can define your models as Python classes and Django takes care of handling the database migrations for you. This way the application logic is completely decoupled from the underlying database.
Django projects are created of loosely coupled building box called apps. Apps help you organize your code into smaller, independent units.
Django apps can be distributed as packages, so everyone can create reusable pieces of software, that can be easily installed and used in any Django project. For a lot of common tasks, you can find ready-made 3rd party packages on PyPi.
Django follows modern security best practices, comes with secure-by-default settings and provides a bunch of safeguards against most common forms of attacks:
- Django has a middleware that protects against CSRF attacks
- the ORM is safe from SQL injections
- dynamically generated content is escaped in the templates, so it provides some level of protection against XSS attacks
You can read more about Django’s security features here
Other Alternatives - Django’s Competitors
Ruby on Rails
RoR is very similar to Django in philosophy, though Django is used more widely. I guess the main reason for that is the popularity of Python itself.
Flask can be considered Django’s main competitor, it is everything that Django is not: small, lightweight, minimal, unopinionated. Comes without any bells and whistles, you have the build and structure your app from scratch.
Symfony and Laravel
Symfony and Laravel are the most popular PHP frameworks. They improved and matured a lot in recent years, which is true for the PHP language itself as well. Both frameworks are quite similar to Django in many aspects.
When Not To Use Django?
There are some cases, when Django can really feel like an overkill. For example, if you’re building a small, stateless microservice, then I see absolutely no point in using Django. If you need only rest API, no UI, no admin area, no database - then Django would provide no benefit at all.
If you are thinking about starting to learn Django I can only encourage you, it is a mature, feature-rich, well-thought out framework.
For beginner developers, Django is a great choice, as it really guides your hand and teaches you some useful design skills.
If you are on a more advanced level, you can benefit from the improvement in the speed of development made possible by the framework’s many powerful features.
- How much Python is required for DevOps
- How Much Python is needed to Learn Django
- How long does it take to learn Django
- Can you learn Python without knowing C