Django apps - what are the implications

Today's post will cover where the app name gets embedded into a project. Essentially the app provides a namespace for certain items, namely the python modules themselves and the Django models. Knowing this is key if you want to move a model or requiring some serious refactoring.

The first obvious places that it crops up is in INSTALLED_APPS and other settings (eg AUTH_USER_MODEL), next is python import statements (from my_app.models import MyModel).

The slightly less obvious places are migration files where app names are used in the dependency list. Additionally the app names get injected into the database in 2 main ways, first is the ContentType model (if that app is enabled) and also in the default database table name for any model, which is myapp_mymodel this is a key part of namespacing so that models from separate apps do not clash.

Tomorrow we will round off talking about apps about the customisations that could be done customising AppConfigs or having multiple versions.