Reputation: 1808
I know that you're supposed to have a templates folder within each app folder, how I have two questions clarify further. 1, Should I have 2 base.html files (one in each app) that are identical? This seems like it's creating more files than need be... and 2. What about the static and media folders? Should I also have two of each or should they be at the project and app folders level?
If there is supposed to be a static folder in each app folder then do I have two css files? I feel like that makes no sense since the css can cover things that overlap from app to app.
I'm also wondering if have it setup the way I currently have it will effect anything, or if "best practice" is more so just for if you're working on a project with multiple people (which I'm not, in which case should I care?)
Here is my current structure:
/evverest/
/evverest/
/feed/
/users/
/blog/
/templates/
/base/
/feed/
/users/
/static/
/css/
/media/
/post_pics/
/profile_pics/
Upvotes: 5
Views: 1984
Reputation: 4354
This can be a little bit confusing. I like to do this:
templates/
folder. This should include base.html
and any other templates from other plugins that you're overriding.templates/
folder inside the app, e.g. blog/templates/blog/blog_index.html
. These templates should {% extend 'base.html' %}
so that all apps in the project are using the same base template, which is in the global templates folder.STATIC_ROOT
folder from your Django settings, which I've called assets
below. I'd stick to using the one folder for simplicity.Here's an example of how this would look:
./evverest
├── evverest/
├── feed/
│ ├── templates/feed/feed_index.html
│ └── models.py
├── users/
│ ├── templates/users/users_index.html
│ └── models.py
├── templates/
│ └── base.html
├── static/
│ └── css/main.css
└── manage.py
For more on best practices, check out cookiecutter-django
. There's quite a lot to learn, but they're interested in following best practices, so it's a great resource.
Hope this helps!
Upvotes: 5