I have website which contains main pages like Homepage, About Me, Contact, Gallery, etc.
Additionally I added Blog pages and Courses pages but since they have their own models and logic I implemented them as separate Django apps.
So I ended up with 3 apps: my_app, blog_app, courses_app.
When I started with my_app, I just put all logic and all frontend part (jss, css, …) and templates into it.
Now I realized that blog_app and courses_app have to use the same frontend and templates as my_app. So I created templates in each blog_app and courses_app but they extend and use templates and frontend from my_app. So it looks like a total mess to me.
Now I’m starting a new project and would like to make it right this time.
So what would be the correct structure ?
I was thinking to create this apps:
-
core_app- which contains frontend (css, jss) and html templates for a website -
main_pages_app- which contains models, views, logic, etc. for most of the website pages. It contains alsoadmin.pyto manage the models. -
blog_app- which contains models, views, logic, etc. for blog. It contains alsoadmin.pyto manage the models. -
courses_app- which contains models, views, logic, etc. for courses. It contains alsoadmin.pyto manage the models.
Regarding templates in main_pages_app, blog_app, courses_app, I’m thinking of 2 ways to go:
- each app will contain templates which extend from base templates located in
core_appor - all html part will be written in
core_apptemplates (other apps will then just pass the data to this templates).
Does this idea make sense ?
Is there a better approach to that ?
Thanks!
.