Foad Moha

Foad Moha

Python Developer

© 2021

3 tips for overcoming Django's learning curve

Do you feel that learning Django was harder than you anticipated? Or that even though you have followed some tutorials, you still don’t have a grasp over what Django does? and how?

Learning Django can be overwhelming. There is a learning curve to this beast of a framework. It is completely natural to feel disoriented in the beginning while you are learning it.

Here are my 3 tips to help you learn Django and to make the learning curve less steep:

1. Get your hands dirty as soon as possible

There are plenty of good tutorials out there. Here are some of my favorites:

But as soon as you think you have the basics, get your hands dirty! Start working on your own projects. Don’t jump from one tutorial to another.

Tutorials are a great way of getting introduced to Django. But an introduction is not enough. You need to immerse yourself in it. That is when you grow. You start running into problems, unknown errors, database issues, etc. Try some things yourself, read the docs, search online and ask questions. Don’t be afraid to make mistakes. Before you know it you have created your dream web app while learning a new skill. Awesome!

2. Understand Django’s design pattern

Django builds on a common design pattern called Model-View-Controller or MVC.

  • Model: This is the representation of the data. Think about it as the way you want the data to be stored in your database.

  • View: This is what the user sees. The pages on your web app and how you want to show some data to your user.

  • Controller: This is the logic that is used to show, filter or alter the data that you show to the user. Also the operations you do on the data when the user sends it to your web app.

How does this help you to understand what is going on?

Following MVC, Django separates different aspects of your web app from one another. In Django, how you represent your data in your database is in your models.py and is separated from how you show the data to your user in your templates.

The views.py file makes the matters complicated because it has the Controllers in it and parts of the View. Your templates also are parts of your View.

So instead of being overwhelmed by all the things, you can divide your attention to different aspects of your web app. You can learn a bit about models and storing your data without thinking about how to present them. You can focus on your user interface and how it looks without bothering about how to treat the data that the user gives you.

Learn the basics of each part and move on. Divide and conquer!

3. Do things the Django way!

This is the thing that puts off a lot of experienced web developers and confuses the newbie Django developers. In many other web frameworks, you are free to do whatever you like. You can route the urls however you want. You can write your own user models. Do forms your own way, create your own admin page, etc.

But not in Django!

Not that it’s not possible. But you will feel pain whenever you go against the “Django way”. This is why people say Django is opinionated.

Django provides you with a way to easily do something. As long as you follow the way, Django takes care of the nitty-gritty implementation details for you. That way you can focus on the functionality of your web app and providing value for your users.

Because of this design philosophy, some things will feel magical. For example you can use Django’s Model class to create, filter, and process objects in your database without writing a single line of SQL code. You won’t see any of the “talking to database” part.

If you want to learn Django and want to learn it fast just accept the magic. Later, you can go back, look under the hood and figure out HOW Django does some of these things.

You can do this!

No matter if you are learning Django because your boss told you to, or you want to bring a brilliant business idea to life, learning Django will be hard in the beginning. Like any skill it will take time to master. Things will feel hard and confusing at first, but after a while the clouds will part and you will see the light. When it clicks in your brain, no one can stop you from creating amazing web apps! 😃