Codementor Events

How I learned Django

Published Jul 11, 2018
How I learned Django

About me

Hey. I am Himanshu Shankar. I am a Product Developer. I have worked upon various products that serves Indian Industry. These include EventHaat, 101Lease, 101Housing, HisabKitab, SafeHoms. I also advise StartUps on technology. I am running my own Tech StartUp that goes by the name of Civil Machines Technologies Private Limited.

Why I wanted to learn Django

I had developed three products with PHP as a backend language. I had use Joomla, Laravel and even made some RESTful APIs with pure PHP by using some libraries. But I was facing a lot of trouble in reusing the already built products. The customization was tough and it consumed a lot of my time.

I had used Python before majorly for scripting purposes. I had also developed some ChatBots using Python. So I googled Django. I was amazed at the development speed in Django. As I was using Cloud Computing for deployment, the problem of Python support was not an issue for me.

So, I started Django majorly because of:

  1. Modularity that Python provides (already tested in non-Web developments also)
  2. Libraries that Python already had can be used anywhere
  3. Community Support is huge
  4. Development speed is amazing
  5. Because of modularity, reusability doesn't requires huge modifications
  6. And finally, Python is pure love ❤

How I approached learning Django

In any technology, my approach is always to start with official documentation. There is a reason behind it. Say, you are a fan of The Godfather - Trilogy, what will you prefer? Movie or summary?
Youtube videos/tutorials are good. But remember, they share their perception of official documentation only. They also started with official docs. If a language doesn't have official docs, leave the language. It won't have much support. So, any technology/language you are starting to work on, check on official documentation.

Official Documentation mostly has a tutorial. This tutorial is to get you started in a speedy way. Follow this tutorial. I just skimmed through it. No use of getting into deep details.

Once the tutorial is completed, it gave me a taste of Django and what sort of stuff I can do with it. Now, the next step is to pick up a project. Just think of any basic project. It can be a simple login/logout API. I chose to develop a login/registration API with OTP functionality. Have a look at features that I would learn while developing this:

  1. Building RESTful API in Django (required Django REST Framework)
  2. Customizing the default User app
  3. Sending Emails in Django
  4. 3rd Party APIs integration in Django
  5. Database integration in Django
    and a lot more.

While developing my first project, I needed to know how things are working. Then only I'll be able to have fun in Django. So now, rather than Googling, I always referred official documents and went deep into it. This enhanced my knowledge.

If I had Googled, I would have developed the app sooner, as the questions are easy to ask. But then, I would never be able to answer the questions.

Challenges I faced

  1. The most difficult part of learning Django is understanding how middlewares are working in Django. While it is very easy to do a top-level task, the major advantage of Django is that it comes with all batteries included. This means that there are a lot of things that are happening inside the system that one may not have even idea of it. And hence, when you need to do a certain task that is happening behind the curtains, you will find difficulty.

  2. The next thing is quality. It is easier to miss or ignore in compare to difficulty in learning it. Quality is the major focus in Python also. While not following conventions are okay, but remember, automated tests such as Travis CI, and Open Source libraries will always create an error if you've missed a convention. This is more of a Python thing than Django.

  3. While learning Django is easy, when you start to solve business problems in Django, the difficult part is to decide apps that you'll be developing. So, majority of your time will not go into coding, rather you'll spend time majorly in deciding the models of your data and segregation of the apps. With time, this will become easy.

Key takeaways

To sum it up, the following are things that you must take care of while developing an app in Django:

  1. Focus on reusability while creating apps. Ask yourself,

Can I just import and use this app in my any other project?.

  1. Take special care of quality.

  2. Understand what is happening behind the curtains inside Django

  3. Focus on your Models. Once you've structured your models, things will become easier for there on. So, spend your time in sharpening the ax.

  4. There is a better way to do the same task. Find that in the documentation

But here's the fun part in Django:

  1. The speed of development is very fast
  2. A lot of things are already developed and available
  3. Middlewares ease your task a lot
  4. Code less, create more!

Tips and advice

If you want to have a command of Django, I'll suggest that make sure you do understand how things are working inside Django. I can vouch for official documentation as the best source of knowledge available for this. You can also have an offline version and consider it as the best textbook available for Django.

Final thoughts and next steps

Finally, the next step is to code n create. Don't forget to share your code on GitHub.com. Maybe you can save other people a lot of time. I have also shared a few of apps that I have created for others:

  1. Django REST Framework Add Ons
  2. Django REST Framework Contact
  3. Django REST Framework Feedback

After this, what I learned next was Django REST Framework. I will share my experience on that also.

Discover and read more posts from Himanshu Shankar
get started
post commentsBe the first to share your opinion
Manish Kumar
6 years ago

Impressive ! Nicely done !

Vijay Sehgal
6 years ago

I liked it. You should more often write.

Himanshu Shankar
6 years ago

Sure Vijay. Going to write more often.

Mahen Manish Gandhi
6 years ago

Nicely explained. Well Written!!!

Himanshu Shankar
6 years ago

Thanks, Mahen. I am glad you loved the article!

Show more replies