Learning a framework is challenging. You have to become familiar with the way things work, where everything is situated, and how to make the most of the tools provided to you. Django is no exception. It's a fairly big code-base, with a lot of tools and functionality. Learning everything Django provides can take a really long time. Thankfully, most of the time you can actually achieve your goal without having to learn everything there is to know about Django.
In this post I'm going to explain the most important concepts you should know to get a job as a Django developer.
It's worth mentioning that this list is entirely my own opinion. It comes as a result of working as a professional Django developer for the last three years.
If you prefer video format, you can watch the video version of this tutorial here:
These are the concepts you need to understand (in order of importance):
- Database design (most important)
- Authentication and Authorization
- Flow of data (forms → views → database → and back)
- How static and media file configuration fits in with Django
- Worth mentioning: Be comfortable being uncomfortable
Stand out skills:
- Integrating with 3rd party APIs
- Building APIs (e.g DRF)
- Integrating with frontends (React, Vue, etc.)
- Task queuing (Celery, Django-Q, etc.)
So let's get started!
Data is the most important part of any web app. How that data is stored, retrieved, and used is crucial because the rest of the project depends on it. Hence, setting up a database is one of the first steps when starting a new Django project.
You will continuously be using Django's
Model to design the database schema. Because the schema has such a big impact on the rest of the project it's important to make sure you've designed it correctly. You'll need to be very comfortable with Django's
Model to up-skill in database design. This will require you to understand all the different types of table relations such as Foreign Keys, OneToOneFields, and ManyToManyFields.
A good understanding of database design is the foundation of having a good understanding of Django.
Authentication and Authorisation
When I was learning Django I neglected this section for way too long. This should have been the section I spent the most time learning. Almost all web applications you'll build will require some form of authentication.
The first step is to understand the difference between authentication and authorization is. I recommend you to start by learning the built-in authentication provided by Django. Django's
auth module contains a lot of views and forms that make up the authentication logic. Going through that code and understanding what each form and view does will give you a good starting point for how it works underneath the hood.
While learning the built-in authentication it would also be good to learn the different types of authentication such as session and token authentication. If you have a good understanding of these then you might want to look at JWT authentication.
If you have a solid understanding of authentication you'll then want to start going through the most commonly used packages such as Django AllAuth. You'll most likely make use of third-party packages to handle authentication because it's very repetitive. So start becoming familiar with the available packages and what might be best for your use-case.
Flow of data
You might have heard of the CRUD acronym (Create Retrieve Update Delete). This acronym represents the types of actions that are performed in a web application. Using CRUD you can design your views to focus on allowing one or more of these actions to be performed.
Take for example the Create action. To implement this action you will need to implement a form that takes in data and creates a resource (normally through a Django model). Django's Class-Based Views are very good at minimizing the amount of code written in CRUD views, but they also abstract a lot of logic. I highly recommend going through the source code of all Django's generic class-based views (CBV) and understanding what each method does, the order of execution of those methods, and ultimately understanding how those views are handling the logic of CRUD for you.
FormView particularly has a lot of methods that can be accessed. These are some common methods you'll want to understand:
Part of understanding the flow of data is understanding how data moves between the user and the database. This means understanding how data is retrieved from the database, passed into the view, and displayed in the template. Likewise from the other way around - understanding data being passed into a form, submitted to the view, and stored in the database.
Static and media file configuration
One of the more challenging concepts is that of static and media files. This is because the setup is different depending on whether you're in local development or production. Understanding the difference between the two is important. I also recommend learning about the S3 protocol and why it's advantageous to store your files on a separate server using a service such as Digital Ocean Spaces.
Understanding static and media files will also help you understand the deployment architecture of a modern web application.
This is one of the most important sections of web development. Today there are many services you can use to deploy your Django project, but what's important to understand is the fundamentals of how a Django server is run in production. A traditional setup would involve manually setting up gunicorn and nginx on a server. A more modern approach would be to use Docker and deploy the docker container.
In fact, I would say that the more you know about deploying a Django project, the better it looks to potential employers.
Sometimes when you're on the job, you might not know the answer off the top of your head. And that's okay! We're not computers. We're not supposed to memorize everything. But what you will need to be good at is researching. What I've learned is that the developers with experience simply remember where to look and what to search for when they come across bugs or problems they haven't faced before.
Unfortunately, the only way to get better at this is to keep building projects. The more projects you work on, the more opportunity there is to face a new challenge and to learn something new.
Be comfortable being uncomfortable
This might seem like one of those cliche things to say, but it's true - having the right attitude is very important. Sometimes your job requires you to work on things you don't want to or to fix bugs you didn't expect.
You need to become comfortable with working in situations that are uncomfortable.
The better you are at this, the more valuable you will become. It's important to approach problems with the right attitude:
- Take a breather
- Reflect on your problem
- Do some research
- Don't stress too much
Every role is different, so it's difficult to provide a one-size-fits-all list of skills. But in my experience this is what can set you apart from other Django developers:
Integrating with 3rd party APIs
This is probably the most underrated skill - in my opinion.
One of the hardest challenges I faced in building JustDjango was the architecture of the billing model for the website. I wanted to have a completely customized payment process and this required me to build a lot of functionality that integrated with Stripe.
Stripe is just one example. If you're able to integrate with APIs such as GitHub, Slack, Twitter, and many others, you're showing that you understand almost all of the fundamental aspects of Django.
Today there are entire businesses built on top of other companies' APIs. So this skill is a big one for me, and I think a lot of other companies that leverage APIs.
Integrating with frontends
React and Vue are my two recommendations. I prefer React for larger projects but that's up to your preference. I think it's generally agreed that React is more difficult to learn than Vue, so that does make React a more impressive skill to have.
Docker is a great tool for creating consistent environments between team members. If you're joining a large team you'll most likely be working with Docker so developing this skill beforehand will make your life easier.
Docker is also widely used for deployment. There are a lot of tutorials showing how to dockerize a Django project and it's fairly easy to understand. I think this is a skill you can easily capitalize on. That being said I wouldn't try to become an expert in Docker. The fundamentals are more than enough for you to get by.
Building APIs with Django is very common. So common that I would say that most Django projects either start or are converted into Rest APIs. That being said this is dependent on the project you'll be working on.
The Django Rest Framework is by far the most used project for building APIs. There's an entire ecosystem of packages that integrate with the DRF for various functionality.
This step is definitely a challenging learning curve and I'd recommend you take it slow if you're struggling. Understanding the core of Django is much more important before diving into the DRF.
That being said being able to build APIs is a huge asset to your list of skills.
This is definitely the most project-dependent skill. Some projects don't have any need for asynchronous tasks. It's also a very difficult skill to master. A lot of developers have shared their knowledge on asynchronous tasks because it's constantly provided a set of new challenges and pains to deal with.
I would consider this skill an entire area to specialize in.
What you'll find in these bullet points is that they're not unique to Django. These skills apply to being any kind of developer. The difference is that because Django is a framework, you're expected to understand these concepts and be able to apply them in the way that Django has designed them to be applied.
Concepts like Django's message framework, signals, model managers, and customizing the Django admin are not priorities to understand. These are smaller tools that help you deepen your understanding of Django, but they're not essential.
If you're planning on getting a job as a Django developer in 2021 make sure you understand the concepts mentioned in this post. If you want to stand out from others in the job market, improve your skills in other areas such as front-end development and API building.
It's also important to continuously learn and stay up to date with what's happening in the Django world. Read blog posts and newsletters, listen to podcasts, and pay attention to what others are doing so that you're aware of trends and patterns in the industry.
Want to talk about this post? Get in touch with me