Search code examples
pythondjangodjango-apps

Django App vs Apps?


I have read some StackOverflow answers including Django: "projects" vs "apps" and using django apps vs established apps...security? , but I am still looking for advice how to organize my Django application and why?

My market place app has following functions and I am trying figure if I should split my app or just build a single app and what implications does this decision have?

  • home - front page, search, and rendered cards for search results
  • detail view - what you see when you click the result card
  • booking flow - pinax stripe payments and few booking views
  • blog - self-explaining
  • messages - django-messages with a customised view allowing provider - customer communication
  • static - t&c, about and contact static pages
  • task - celery jobs for email and other background stuff as needed

this is one app. User searches provider, finds one, contacts provider and books a service. However, when I look for example applications this type of functionality is often split to multiple apps. My questions why? I have limited experience on designing software and afraid I am making the large mistake here.

I plan to separate app with provider listing functions & allowing me to first manually pre-screen providers and automate later.

It has >

  • listing - allows to add listings, pics videos etc.
  • messages - ??? this got me thinking should messages be a separate app as needed in both or should provider listings be under the same massive app
  • API - ?? again I am also going to need this
  • payments - mostly different functions but some code is shared

So finally do I just drop all to one massive app or split as many apps?


Solution

  • It is all up to you. It is ok to have everything in 1 app, but perhaps not so convenient as the project gets (really) large. You can always split it at some later point if needed.

    Having separate apps has two goals:

    • maintainability: to keep overview
    • portability: being able to re-use an app in another project

    If functions belong together, then combine it in the same app. So, your blog is clearly separate from the e-commerce part. But it is probably also just a few lines of code, so not a big deal if it is placed somewhere in an existing app.

    Personally I prefer to have the layout of the home-page (+ about, contact) + template + js/css in a separate app, since that is often not part my application but just a front. For a e-commerce website that could be somewhat different. ( this is what I use https://github.com/allox/django-base-template )