Django - A Brief Introduction
Tags: django, python, webdev, tutorial
Published: 2022-04-25 07:13:05

## What is Django?

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/247kbpvscy8whia8t0zy.png)
Django is a robust Python web framework that was named after one Jean Reinhardt, who was a Roman-French jazz, guitarist and music composer and Django was his nickname according to [Wikipedia](https://en.wikipedia.org/wiki/Django_Reinhardt).
Most of us know "[Django Unchained](https://www.imdb.com/title/tt1853728/)" as the Tarantino movie that was released in 2012 and featured Jamie Foxx however, I am here to disappoint you since this post isn't about that. It is about a rich Python web framework that once you dip your fingers in it, you'll highly likely want to dip your hands and feet in it. Let us briefly unbolt Django.
Django can also be referred to as an Model-View-Template (MVT) framework used to build web applications.

## Who uses Django
Websites that use Django framework include (but not limited to) the following:
1. [Disqus](https://disqus.com/)
This is a social website build on top of Django and other frameworks. It supports discussions, comments and audience activity analysis.
2. [Instagram](https://www.instagram.com/)
A social network platform currently owned by Meta (previously FaceBook) that supports media uploading, social account management and handles huge traffic and enormous amounts of data thanks to Django.
3. [Spotify](https://www.spotify.com/)
Music streaming and sharing platform that enables millions of subscribers around the world to listen, share and purchase music.
4. [Bitbucket](https://bitbucket.org/)
Cloud-based Git repository that hosts millions of code repositories and supports developer communities 
5. [Mozilla](https://www.mozilla.org/)
The [code behind](https://github.com/mozilla/bedrock) Mozilla website is based on Django project and serves very many diverse and independent pages with huge amounts of static and media content (images, JavaScript and Cascading Style Sheets).

Other Django powered websites include: [Pinterest](https://www.pinterest.com/), [Quora](https://www.quora.com/), [The Onion](https://www.theonion.com/) and [NASA Website](https://www.nasa.gov/)

## Why Django
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ui33228y2x1sl6z1elra.JPG)
Django framework is simple, yet sophisticated with a "batteries-included" approach which includes out-of-the box for mostly used functionalities such as the following:

- Administrator user interface
- Security and performance
- Multiple database back end support
- User authentication and by extension authorization
- Rich REST API
- Testing suite

I have recently deployed a simple Django website on Heroku that I developed from scratch demonstrating most of the above features. The live site resides at  http://jkariukidev.herokuapp.com and the code base is on [this repository](https://github.com/jkariukidev/personal-website). I have worked on a documentation to get you going by and it is still being improved.

There are many web frameworks out here but Django still remains that 'elephant in the room' when it comes to full-stack web development partly because of the rich features mentioned above and because; unlike micro-frameworks such as [ExpressJS](https://expressjs.com/) and [Flask](https://flask.palletsprojects.com/) which yield more flexibility, Django surrenders flexibility and reduces opportunities for mistakes (and time spent in debugging the bugs associated with the mistakes) encountered in writing functionality code from scratch. 

Django uses a [Don't Repeat Yourself (DRY)](https://docs.djangoproject.com/en/4.0/misc/design-philosophies/#don-t-repeat-yourself-dry) principle which reduces code duplication.

Django includes a powerful [Object Relational Mapper (ORM)](https://en.wikipedia.org/wiki/Object-relational_mapping) layer by default that can be used to interact with various databases such as MySQL, SQLite, PostgreSQL and Oracle without having to rewrite the SQL dialect (language) code for each database back end since each database has its own dialect.

## The Blues of Django

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/howdpifkxc03wnhxv3wb.jpg)
While Django is all good as a framework, there are some cons that come with it just like any other framework.

1. Django can be a bloated framework for small projects. It may not be the best approach for small projects like one page websites and the like. Preferable for projects such as blogs, social websites and e-commerce sites.
2. Monolithic architecture that limits developer's freedom in introducing new implementations outside Django. A workaround to this would include adding third-party packages into a Django project.
3. Full knowledge of the framework may be required to kick-start on projects and may take time to learn the whole framework.

## References
Interested in learning Django? Here are some reference links to posts and some reads on the ever growing web development framework.

- [Django official documentation](https://docs.djangoproject.com)
- [Learn Django](https://learndjango.com) By William Vincent
- [MDN Django Documentation](https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django)
- [Django Girls](https://tutorial.djangogirls.org/)