1π
β
It depends. Since my apps share the same set of static and templates I store them in root dirs:
# Settings
STATIC_URL = '/static/'
STATIC_ROOT = abspath('static')
STATICFILES_DIRS = (abspath('styles'),)
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
...
)
TEMPLATE_DIRS = (abspath('templates'),)
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
)
# All styles are in one place
βββ styles
βΒ Β βββ less
βΒ Β βββ js
# App's templates are stored in privite dirs so I can move them in app dir any time
# without changing my code: flatpages/flatpage_detail.html Also it works well with
# class based views.
βββ templates
βΒ Β βββ base.html
βΒ Β βββ flaptages/
βΒ Β βΒ Β βββ flatpage_detail.html
βΒ Β βββ another_app/
βΒ Β βΒ Β βββ another_app_detail.html
Then I do manage.py collecstatic
and have all static in root/static
dir.
It fits me. But if I would make an app to share with community I will put static and templates in itβs own dir as described in docs.
π€byashimov
Source:stackexchange.com