How do you structure your django projects?
I really love Django. It is extremely easy to get started with, even if you don’t know any Python (I didn’t when I started using Django). It is also very customizable, you can change the entire directory structure if you want to. As a project grows, like the Fyndiq codebase I am currently working on (around 15 000 – 20 000 lines of html/python/css/javascript not counting 3rd party code), you have to restructure a bit to get some order. This is kindof how my current layout looks, but I’m changing it whenever I get better ideas:
apps/
subsystem1/
app1/
app2/
subsystem2/
app1/
app2/
subsystem3/
app1/
app2/
docs/
scripts/
manage.py
urls.py
settings.py
and so on...
static/
subsystem1/
img/
css/
js/
subsystem2/
img/
css/
js/
templates/
subsystem1/
subsystem2/
var/
img/
log/
I am pretty happy with this. It is nice to have a var/ folder with all data that is not part of a deploy (I simply create soft links from static/ to subdirectories of var/img/). It is also nice to have the templates outside the apps, as I find I often borrow template files between apps. The only thing I am not totally happy with is how each app has its own models, since my apps often use each others models. It would make much more sense to have some kind of centralized models/ folder in the project root, with all database stuff. Haven’t gotten around to fixing that yet though.
Jag spenderar det mesta av min tid med att bygga ett