Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Hint: You can adjust the default video playback speed in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

Django's Double Folder Structure

In the previous lesson, you created a template, and now you’re going to see how to set it up. In production, Django eventually collects all of the templates in various folders and puts them all together in one folder for all the templates.

That can work fine, but there can be some problems with a flat folder structure, so it can be best to use a double folder structure instead.

Comments & Discussion

reblark on Oct. 31, 2019

Is this “universal” templates folder hidden?

reblark on Oct. 31, 2019

So that I understand the file structure more clearly, the first thing I do is create a folder to put all my work for django in, for instance django-portfolio. But then I create a sub-folder, for instance projects, which becomes my apps central folder(it could be “portolio”. In that folder, I put whatever apps I want to build in this structure. So, I might build an app called “projects” and an app called “monies” and an app called “travels.” Inside each of these apps will be the files from init.py to views.py and inside the views.py app will be the templates that will be used by each of the apps above and contained in that app structure. So, all the files in views.py in each app will have the app name in its path and live in the templates folder as app/commonname. The point being that in the total structure, templates lives above all the app structures and collects all the templates from all the apps into its one folder. (Not sure about how well I wrote this but I think I have the point.)

deodesumitsingh on Dec. 28, 2019

I learned alot with this single video. Thank you alot for sharing Django project structure in simple terms.

Martin Breuss RP Team on Jan. 23, 2020

Glad it was useful @deodesumitsingh! :)

Samuel Barbosa on Jan. 28, 2020

I had never paid attention to that detail. Thanks @mbreuss

ken4 on May 15, 2020

Really liking this tutorial so far. Most clear and understandable one I have run into so far. Haven’t had any questions pop up that weren’t answered. Other tutorials just were confusing.

Hector Perea Mosquera on July 13, 2020

So far, the best Django tutorial that I’ve seen so far. Very useful, and the folder structure explanation was very clear. Thanks a lot for this.

Become a Member to join the conversation.