2021: How to start your Django project

Gustav Willig
3 min readApr 10, 2021
Photo by
Maxim Ilyahov on Unsplash

TL;DR: Before setting up your project think about the general structure, which apps will be there which unique feature will they have and how will the model look like. The next step is to consider if to use an open-source, front end, JavaScript library like React to follow the clear rule of SoC (Separation of Concerns)

Back in 2017 I would just follow these steps:

  1. Create a new folder and a venv for your new project:
    python -m venv venv
  2. Activate your venv
    venv\Script\activaite.bat
  3. Install the latest django version:
    python pip install django
  4. Create a new django project:
    django-admin startproject project2017
  5. Verify that the creation of the django project was succ
    python manage.py runserver
  6. Create an app
    python manage.py startapp project2017App

That`s it. If you know ask yourself why you should not do that in 2021. Ask yourself, in your last project wha

(That should be always the first step. If you need some good reasons why, check out my article: https://gustavwillig.medium.com/how-to-use-python-venv-8abe01e04b37)

So what is the problem with this approach?

  • One giant app: Most people will just stick with one single app and it will be more and more difficult to organize a growing codebase without using separate apps.
  • Jinja templating: The server side language has been dealing with template language naturally, you build the logic by the server side language, combine with HTML. That was fine in 2017 but these day I would recommend you using an open-source, front end, JavaScript library like React to keep your application more reusable If you need some good reasons why, check out my article: https://gustavwillig.medium.com/how-to-use-python-venv-8abe01e04b37)

Before I can tell you how to improve these approach we need to talk about Django REST Framework. Django REST framework is a powerful and flexible toolkit for building Web APIs (https://www.django-rest-framework.org/)

So as you maybe already suggest it, in 2021 I would use Django REST Framework and React for my project.

My approach in 2021 would be:

  1. Create a low fidelity wireframe with Balsamiq ( https://balsamiq.com/) which include the most basic content and visuals and are usually static (not interactive). They are often used to help map out the shell of the interface, its screens and basic information architecture.
  2. Define UML use case diagrams to describe a set of function which the application should be able to performe
  3. Create a high fidelity wireframe with Axure to show are more complete representations of the end product than low fidelity wireframes. Many are clickable and respond to the user’s actions, mimicking authentic interface interaction.
  4. Determine which models are needed: Based on the high fidelity wireframe it should be easy to define which kind of models are need
  5. Determine the endpoints for your backend: For each model there should be at least CRUD (create, read, update, delete) endpoints available
  6. Break each view of the high fidelity wireframe into a hierarchy of components
  7. Define what events should happend in each component
  8. Determine the data each component needs

Good luck for your next project.

--

--

Gustav Willig

An AI Full-Stack Developer with a passion for using data to drive business decisions. Get your latest news about Django and AI trends by subscribing