How do I store all my custom app in one folder

I have a new django project with Users and Vehicles apps. I want to store them in one folder called apps. I added them to installed app in setting.py using the syntax below

INSTALLED_APPS = [
    ...
    'apps.users'
    'apps.vehicles'
]

and added the path to the apps folder at the bottom of settings.py

sys.path.insert(0, os.path.join(BASE_DIR, 'apps'))

but I still get the “ModuleNotFoundError: No module named 'apps.usersapps” error

Short answer - Don’t do this. It causes a lot of potential problems and confusion, and doesn’t really provide any tangible benefit.

Background and explanations - See my response at The drawbacks of using an apps sub-directory - #2 by KenWhitesell and the links to my other comments referenced in it.

I usually agree with Ken that it’s best not to fight against the framework, and you should do things the default way.

But I like putting the apps in a separate folder like this because I find it less confusing than having them mixed in with other non-app folders. Once set up I haven’t encountered any problems.

Please show the full traceback of the error so we can see where the error is coming from.

:wink: In my own defense, I did write:

I would never discourage anyone who understands what they’re doing from doing something that isn’t considered “standard” or “typical”. (Heaven knows I do it frequently enough.)

However, if you’re relatively early on in your learning curve, those atypical configurations can lead to problems that are difficult to understand and fix. And if you’re still working your way through the fundamentals, you don’t really want to make things harder for yourself.

1 Like