I’m working on a Django project and trying to keep the codebase maintainable as it grows.
I’m interested in hearing what practices other Django developers consider most important for production applications, especially around:
-
keeping business logic out of views
-
deciding when to use service/helper modules
-
organizing models, serializers, and API views
-
handling settings for development, staging, and production
-
avoiding circular imports
-
structuring larger Django apps
-
logging and exception handling
-
writing tests that remain easy to maintain
For example, when a view needs to perform several steps such as validating input, querying models, calling an external API, transforming the result, and saving data, do you normally move that workflow into a service layer or keep some of it in the view?
I know there is no single correct project structure, but I would be interested in patterns that have worked well for larger Django applications and practices you would avoid after maintaining Django projects in production.