Skip to content

Instantly share code, notes, and snippets.

@brndnsmth
Created March 10, 2024 20:06
Show Gist options
  • Save brndnsmth/3ff8e8aa3f9fac28e278c48753a12d57 to your computer and use it in GitHub Desktop.
Save brndnsmth/3ff8e8aa3f9fac28e278c48753a12d57 to your computer and use it in GitHub Desktop.
Django Project Structure - Modular App Design

Django Project Structure - Modular App Design

A small project today could lead to its expansion with additional functionalities, necessitating separate applications. As you incorporate more features, the views.py file might swell with disparate code segments, complicating navigation and comprehension. It’s preferable to manage a concise, 200-line views.py file focused solely on your store app rather than wading through over a thousand lines of unrelated code.

Collaborative efforts benefit from modularization, as it simplifies task delegation among developers.

Modular apps enhance the flexibility of your codebase, allowing for straightforward integration or detachment from your current or future projects.

Suggested Directory Structure - Position all applications within an apps/ subdirectory to maintain an uncluttered root directory. This approach aids in the immediate recognition and understanding of the project’s framework and layout.

myproject/
├── apps/
│   ├── account/
│   ├── blog/
│   ├── core/
│   └── store/
├── media/
├── myproject/
│   ├── asgi.py
│   ├── settings.py
│   ├── urls.py
│   └── wsgi.py
├── static/
└── templates/
    ├── account/
    ├── blog/
    ├── components/
    ├── core/
    ├── store/
    └── base.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment