7

As my Django projects are bigger and bigger I am facing issues regarding architecture. Before starting to code, I spend a lot of time to find a nice architecture for my project: how I split my project in apps, which apps are dependent on other apps and so on. To be clear, by architecture I don't mean project layout.

I have done my research and I haven't found yet a ressource showcasing some methods to find the best architecture for a given Django project. Outside web development, UML seems to be the way to go.

My questions are:

1) Why is there almost no discussion about those topics on the internet ? Am I missing something and totally wrong in my approach ?

2) Can UML be used to work on Django project architecture ?

3) Is there a common way to tackle this issue with Django ?

Ali Baba
  • 350
  • 1
  • 4
  • 12

3 Answers3

6

Before starting to code, I spend a lot of time to find a nice architecture for my project: how I split my project in apps, which apps are dependent on other apps and so on.

I think you're overthinking this. Your project architecture can (& probably should) evolve as you go. You can start with 1 big app and then split it when the appropriate structure becomes obvious to you.

1) Why is there almost no discussion about those topics on the internet ? Am I missing something and totally wrong in my approach ?

Because the short answer is "it's up to you" or "it depends on your project". This will help you: Django: best practice for splitting up project into apps

2) Can UML be used to work on Django project architecture ?

I don't see why not.

3) Is there a common way to tackle this issue with Django ?

There are several ways, consider dividing your apps around:

  • Responsabilities (1 app to do 1 thing)
  • Reusability (an app could be ported with no to limited changes to another project)
  • Ease of use (another dev can guess where a model / view should be)
Community
  • 1
  • 1
François Constant
  • 5,531
  • 1
  • 33
  • 39
  • 2
    I dont think that making an architecture before coding is overdoing in any way. This is the best approach one can take. Think first, act afterwards. Not vice versa. – qwerty_so Sep 25 '16 at 13:03
  • Previously I used to go straight to the code but I noticed that I am much more productive when I plan ahead. When design is well done, coding becomes much more easier – Ali Baba Sep 25 '16 at 20:18
  • 1
    I'm not saying to go straight into code but there is a balance to find, basically: think a little => act => reiterate. – François Constant Sep 25 '16 at 23:54
2

If you would like to have some guidance on how to create a UML design for a web application, you may like my white paper "Technical design in UML for AngularJS applications". It focuses on Angular apps, but most of it applies to web apps in general.

www.admiraalit.nl
  • 5,768
  • 1
  • 17
  • 32
1

After gathering more information I came accross an interesting architecture (I have found the idea on reddit but could not retrieve the url).

Your whole code should be sperated into independent apps (separation of concern) and you need to define 2 "project wide" apps (site and utils):

  • the site app can depend on any other app.
  • the utils app does not depend on other apps but other apps can depend on it.
  • the independent apps can only depend on utils.
Ali Baba
  • 350
  • 1
  • 4
  • 12