Django Or Flask (2022)? Small Scale Application
Tags: django, flask
Published: 2022-06-09 13:31:49

## **What Is Django?**
[Django](https://www.djangoproject.com/) is a Python framework for creating fast, clean, scalable and secure web application in a matter of hours. Some of the popular websites built with Django framework are [Youtube](https://www.youtube.com/), [Instagram](https://www.instagram.com/), [Mozilla](https://www.mozilla.org/) and [Spotify](https://www.spotify.com/).

## **What Is Flask?**
[Flask](https://www.fullstackpython.com/flask.html) is a lightweight Python microframework for creating web applications. It gives developers flexibility and an easy time for to create and run a web application. [Netflix](https://www.netflix.com/), [AirBNB](https://www.airbnb.com/) and [Reddit](https://www.reddit.com/).

Developers are often faced with challenges when it comes to choosing the right path to take when creating a web application. There are plenty of options out there, however, today we'll majorly focus on Django and Flask as a choice in creating a start up or small scale web application.

## **Configurations And Getting Things Up and Running**

The question comes, how fast and and efficient is it to set up and run each application? We'll have a side by side comparison on the amount of time, configurations and installations required to run a "Hello world" HTML file. _See images below._

**Django Setup**

...The first step is creating a virtual environment and installing Django
![Setting up Django project](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gsrztqwj5p67egbd7c7v.png)

...Initial folder structure on first launch
![Initial structure on first launch](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wpwoh8l4duvatuykq9ac.png)

...Before using our app, we need to register it in the installed apps sections
![Register app in the installed apps sections](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r2j41ba7y09vgagwxy3z.png)

...Set the file path to the app folder that will render our URLs.
![Set the path to the file responsible to render the desired template](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vpj70xslysb1buffzg5u.png)

...After creating this file, in here we define the mapping between our views and URLs
![After creating this file, in here we define the mapping between our views and URLs](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ai4m0yyhfrboznyw0xiu.png
)

...Now we create our templates folder, then inside the views.py file we define a function that will render our template.
![Now we create a function that will render our hellow world file.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xfit775pf4czwjj7hrjf.png)

And Finally we run our application...
![And Finally we run our application...](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tyyih7gpe9qydptct1io.png)


**Flask Setup**
...The first step is a creating virtual environment and installing Flask

![Creating virtual environment and installing Flask](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d8k9o64d0ae1ypdcawkr.png)

...Initial folder structure on first launch
![Folder structure on first launch](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kl2pcoomsh4yyfzbj7b7.png)

... We create a single file that is responsible for rendering our desired template.
![Creating our Flask app](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qosku05tmbndbfl8iqg9.png)

And Finally we run our application...
![We run our application](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d4fjzq1c50gb8zx2rfw8.png)

## **Which One Should You Choose?**

While Django comes out of the box with common functionalities such as authentication, URL routing and templating engine, it has a steep learning curve that requires indepth knowledge of the the framework. Flask on the other hand is very minimalistic and you can have the web application app and running in any way possible. This makes doing a small scale web application very easy and seamlessly. As seen above, the best option for a fast, small scale web application would be to use the Flask. 

However, if you have plans to develop or scale your web application in the near future, Django would be the best option because for such a project because Django is set to scale and grow and has a large supporting communinity of developers.