Django Structures: Many apps VS one large app

django apps
django multiple apps structure
django tutorial
django reusable apps
django project structure
django installed apps
django shared models between apps
django project vs app

I hope this is not a opinion based question but more like a solutions to a complicated django website. fyi, i am quite a beginner in django.

first of all, i am doing a complicated accounting django website where there are features like:

  • purchases (purchase order, quotation request, quotation, invoice, do)

  • Custom user roles and permissions, because we want user to setup their own roles and permissions system

  • sales (POS, stocks, too many to mentions)

  • user and registrations

  • incomes & expenses tracking and reporting.

There are articles and SO's answers about 'many apps vs 1 large app'. My confusion started. I figured out django allows seperating and into multiple file in app/views and app/models with imports.

I personally do not like large app file as it is hard to locate things. I prefer neat structures. But the confusion keeps attacking. I want to do one thing and do it well but it seem like having one large app makes more sense because all the mentioned features are ForeignKey dependent.

So, according to your experience. what's your ideal folder structures and solutions to deal with this?

If you could provide performance difference that would be helpful.

UPDATE: Since most people said multi apps, I have last question regarding this. Since Django app can have models/ & views/ folder with multiple & inside, that means one large app can be seperated into multiple views files inside a views/ folder. What yall think about this? since this will put all migrations in one place, does it provide long term safety in term of messy things like foreign keys across apps.

Django Best Practices: Projects vs Apps, An explanation of Django structure and what constitutes an app. There is only ever one project and many "apps" within it. So for our blog Apps. A Django app is a small library representing a discrete part of a larger project. Django is a high level web framework written in Python, and has been around for many years now. Hence it is very stable, and has a lot of resources online if you ever get stuck. Django is a full…

For your solution, i will recommend that you create multiple apps, with each app containing it's own, and What you can do is, create a separate app for user that will contain User model (if you decide to override the existing user model provided by django) and all user related views (such as login, registration etc.). I will recommend that you create a separate model for Role as well that will contain all roles in your system. Make a management command that will add roles in that table, whenever you decide to add a new role. Create an enum type class like:

class Role(enum.Enum):
    ADMIN = 1
    USER= 2

    labels = {
       ADMIN: "Admin",
       USER: "User"

So the first entry in Role table will be Admin with pk=1 and so on.

This was an idea as to how you can create models and keep things separate. You can associate user from a separate app to a table in your sales app as that won't cause you any problem and keep the code readable and things neat.

Tips for Building High-Quality Django Apps at Scale, At DoorDash, most of our backend is currently based in Django and Python. “ apps” to organize different functionality, but had a lot of cross-app ForeignKey's If you have a large production database, there are many unsafe� Prezi, NASA, National Geographic, Quora, The Onion, Reddit, Udemy, Robinhood and many more are out there. So Django is a perfect solution for both startups and large companies. Scalability is one of the best features of Django and it enables any application to handle any audience volume growth with efficiency as well.

For your own sanity go for multiple apps.

just lay them out first and figure out what should logically go together in one app and what should go to the next.

You want to avoid running into circular imports!

Foreign keys across apps is no problem at all. Basically as soon as u use the USER anywhere in your models, you'll reference across app boundaries already.

Top 10 Django Mistakes, 6: All-in-one Application, Bad Application Structure, and Incorrect Resource Placement. Any Django project consists of multiple applications. In Django notation� A Django project comprises one or more Django apps (Figure 3.4) Figure 3.4: Django’s project structure. A Django app is a self-contained package that should only do one thing. For example, a blog, a membership app or an event calendar. Notice at the bottom of Figure 3.4, there’s an extra package called Django Apps.

I'm creating a fairly large Django project. At what point should I start , Normally, I'd just create one app and create views, models and URLs inside this one app. At what point do I start dividing the app into multiple apps? With Django Rest Framework, you can build a powerful Rest API that can be used to power a fully-featured web app. Future of Web Apps This is my personal thought on how future web apps will be

How many apps should this django project have? : django, API connection to an external service (runkeeper, a running stats application) Are each of these bullet points different enough to be apps? or maybe they are too large? In other words This is my preferred organizational structure. Deploying Django with Gunicorn and Nginx: Difference between using socket vs ports. 2 how to query posts by category in django in function based view Mar 9 '19 1 TypeError: int() argument must be a string, a bytes-like object or a number, not 'DeferredAttribute' Mar 3 '19 1 Django Structures: Many apps VS one large app Mar 8 '19

Tips for Building High-Quality Django Apps at Scale, Django doesn't "feel" like most Python projects do. in a single app, or nesting apps to provide a little more structure for how they're connected or separated. That's almost exactly what I do, except for using a big monolithic app for How would using apps organization vs the approach described in the� Basically, a Django project is a collection of many apps. Each app has its own Model, View and Template set, and is responsible for a subfeature of the project. Django supports a more direct way of coding, defining both conventional and unconventional aspects.

  • many apps. personally.
  • If you think you'll ever need to reuse any of these features in another project, keep it in a separate app. The way I do it is that I keep closely related features in a single app. For example, these - "quotation request, quotation, invoice" - seem closely related. They can be used in multiple projects, like in e-commerce, in a freelancer's website, in an agency site, etc. So I'd keep these in a single app.
  • @xyres after digging so much information, i decide to follow your steps. I move closely related (very interdependent) apps into single app while spitting the and into submodule. Oh ya please check the updated question, if you have ideas or feedback please comment thanks in advance.
  • Thanks for the quick response. is there any performance issue when I have let's say 50 apps in a project? let's say each app handle very detail task.
  • Performance depends on other factors than number of apps such as Caching, Database architecture etc. You need to know what performance improvement you want. Let's say you can add AJAX and Cache data and do a lot of task in a single page with a good speed. So I don't think number of apps will be an issue.