Django Project Structure by mraziz

After a couple of years of messing around with Django, I have settled with this project structure that I find to be verbose enough to remind me where everything is:

├── apps
│   ├── blog
│   ├── core
├── fabfile
├── frontend
│   ├── apps
│   │   ├── blog
│   │   ├── core
│   │   └── pages
│   └── libs
│       ├── bootstrap
│       │   ├── css
│       │   ├── fonts
│       │   └── js
│       ├── jquery
│       │   └── js
│       ├── prettify
│       │   ├── css
│       │   └── js
│       └── redactor
├── project
│   ├── env
│   │   ├──
│   │   └──
│   ├──
│   ├──
│   ├──
│   ├──
├── templates
└── requirements.txt
This is compatible with any Django version, and by speculating where Django is heading, it will most likely remain for any future versions.


This is where I store all project-wide files, including middlewares, storages and template tags that I would normally use in different apps.


Almost all my project apps (read modules) reside here. These correspond to Django's apps, which by their own nature can reside anywhere you want within your project's root directory.


My templates to be rendered to the frontend. In the past I used to put this folder inside apps but that did not make a lot of sense since apps contain pure backend logic. This folder looked like a mediator, something residing in the middle between the backend and frontend, hence the separation.


My frontend content as the name suggests. Static files, CSS, JS, images, etc.

This folder in most projects doesn't have very complex logic (aside from downloaded libraries of course). However, in some projects where I take the approach of letting the frontend do the heavy work by utilizing a Javascript MVC framework, while the backend provides pure APIs, this is where it gets way bigger and requires a neat structure. The current structure I'm using fits it perfectly, apps and libs for app-specific frontend logic and libraries/frameworks files, respectively.


A folder where I put all my fabric scripts for deployment. I would rather call it deploy, but fabric requires this name.