Django

From Grundy
Jump to: navigation, search

Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design. Built by experienced developers, it takes care of much of the hassle of Web development, so you can focus on writing your app without needing to reinvent the wheel. It’s free and open source. This is the official description of Django and it pretty much embodies the philosophy behind the Django project.

Django powers many of the Web’s most-used sites, like Pinterest and Instagram. Facebook uses Django for various behind-the-scenes utilities. And Disqus, one of the largest applications on the Internet, is a Django project. Django came from publishing, so it’s no surprise that sites like The Washington Post and Smithsonian Magazine also use Django. But you maybe little interested in these sites and more interested in why you should care about Django. And this article will precisely help you with that. But, let's also talk about what this article is not. This article is not a tutorial teaching you about Django. There are already many articles written by experienced developers which will help you figure that. This article explains why you should care about Django, how is it relevant to you? And after you know that, we will point you in the right direction. Out of the many tutorials we have chosen a few select ones which were most helpful to us, and which we are sure will be most helpful to you.

Why Django?

  • It's based on Python: We all know that Python is one of the most awesome language ever to code, because of the ease of understanding and easy to code nature. Python has a great number of libraries for diverse applications such as Numerical computing, Machine learning, Data analytics which greatly eases up development. Like the Python community in general, the Django community contributes useful packages and utilities for use by the wider world. Searching for “django” on PyPI finds over 3,000 packages available for use. This is on top of Django’s “batteries included” mentality. The framework has already included most things you’re going to want. In short, if I have to sum up the advantage of python in one quote it is this - Life is short, Use python
  • It has an awesome community, great documentation: When Django first came out, one of the features that set Django apart was how good the documentation was. Many other frameworks just used an alphabetical list of modules and all the attributes and methods.Though this is helpful in some cases, it doesn’t help, though, when you’re first learning the framework. Django’s documentation quality may not be unique any more. It’s definitely still one of the best examples of open source documentation in the wild. And keeping these docs to this quality level is still a concern for Django’s developers. Remember! Good documentation can mean the difference between hours of grueling trial and error or effortless implementation. So remember to document your projects as well. Here is the official link to the Django Documentation - Documentation. Another aspect that again sets Django apart is the really helpful community. I personally don't know how many times they have helped me figure something out. Recently the Django Foundation has released a diversity statement making an official stance on the kind of community they want to build. You want to reach out to them with your doubt's, queries and concerns? You can reach out to them on their gitter channel or contact them through the contact us section on their official website.
  • You get to practice and learn the best development principles: The core philosophy of django is DRY: Don’t Repeat Yourself. The framework places a premium on getting the absolute most out of very little code. This means less hours to get it working, less code to break, and less to change when you need to pivot. A Django project is very structured and organized and although there are many ways in which you can accomplish a task in the Django framework there is often only one good way and there is a good chance you will not only follow it but also understand why you followed them. This is because, very often the documentation will itself highlight the best practice to be followed. You will find that almost all the experienced developers follow the best practices and will advise you to do the same, because of the high premium Django places on quality code. For more information on the design philosophies behind Django you can refer to this article. This is also an excellent article explaining the best practices in Django - Django Best Practices.
  • Excellent database management: Django comes with a in built ORM(Object Relational Mapping). ORM in simple terms allows you to write and design your database directly by writing them in python and the Django ORM translates it into database schema of your choice. With Django, you do not have to write SQL queries. It doesn't matter whether you use MySQL or PostgreSQL or SQLite, you wouldn't have to worry about the specific queries for those databases. More interestingly, ORM makes it possible to move your whole project between most major databases by changing just 1 line of code. A web development newbie would highly benefit from this but mind you, this is no reason to not learn SQL. If you want to use MongoDB with Django you might run into a few problems because it is not supported right out of the box. There are various framework you can adopt when you want to use MongoDB for Django. Some of the best are mongoengine and Django MongoDB Engine.

So in conclusion, Django offers stability, tons of packages, good documentation, and a safe and welcoming community. What more could you want?
I know one thing you could want. You could want to learn Django. So now we proceed to do precisely that!

Learning Django

  • Installing Django: The easiest and the recommended way to install Django is via pip - Installing an official release with pip. If should be a fairly easy installation but if you face any problems, you could refer to the full installation process over here. You could also refer to the troubleshooting guide over here or you could simply google your problem (which you should always do before asking anyone for help). If you still face problems you could reach out to the Django community (for details on how to reach them, refer to 'Reaching out for help' section below).
  • Getting started: What better way to learn Django than from the tutorial which the Django community themselves have created. Apart from creating your very first application on Django you will learn the best practices which is necessary if you want to get the best out of this framework. This is the tutorial -Writing your first Django app . Make sure you complete this. Another tutorial, which I found really helpful is Django Girls Tutorial. The title may be a bit misleading (:P), but trust me, this tutorial is meant for all genders and if you are a complete newbie, this is the tutorial for you. If you are more suited to video lectures you should definitely have a look at this video series by CodingEntrepreneurs - Try Django 1.10. This video series also puts a lot of emphasis on best practices and you will also learn a lot about other development tricks and tools. It's a bit long, so I'd suggest you skip over parts you are already familiar with.
  • Becoming a master: After completing the basic tutorials above, if you're hungry for more this section will satisfy you're needs. Developing a full scale Django app for production purposes (when your app goes public and everyone can use it) requires a extra bit of effort. You would have to take care about a lot of things like deployment, security etc. And I believe this tutorial by Marina Mele fully accomplishes this. This is the complete package to become a professional developer. You will learn about security issues, different environments for developing and testing, version control repositories, deployment on Heroku, PostgreSQL configuration, and many more things! This tutorial is a long one and you could skip the things you learnt in the basic tutorials above and focus on what you really want to learn. Overall this is a very comprehensive tutorial and you will understand what is takes to take your product from development phase to production phase.
  • Reaching out for help: The Django community is one of the most open and helpful. You could easily ask your doubts on their official gitter channel - django/django. You could even use their google groups - django-users mailing list, to ask questions about how to use Django. For more information on how to contact them, you could refer to their contact us page here. But remember one thing, just because they are helpful it doesn't mean we try to take advantage of them. Make sure you research your problem well and only if you're sure it's worth asking, then only post your doubt. It's never good to take anything for granted.

Conclusion

I hope you had a good time learning about Django and we hope we have convinced you that if you are thinking about web development learning Django is a good step forward. Even if you want to just start with developing anything but you aren't really sure which direction to do, learning Django would still be a good step forward. The strong focus on good developing principles, great documentation and community are all necessary if you want to be a good developer. We also hope that we have pointed you in the right direction to learn Django and all the tutorials linked over here were helpful to you. You are most welcome to correct any kind of errors you find in this article. Cheers!

See also