Django: Keeping your directory structure clean

March 9, 2017 · 1 min read
Categories: programming   | django   | python |

Hello there!

If you have worked with Django before, then you might know the way you organise your files is very important in making your code reusable. These days I have been trying to DRF( Django’s REST Framework). Along with learning, I am trying to complete a minor project.

So, I found a great article that explained a lot about the way you should keep your files in a project that is built using Django. Here is the link if you want to read it.

Revsys blog post on clean Django directory structure

In this post, I am going to discuss the discrepancies that I discovered while following the tutorial.

  • After dividing the settings into some parts, your code breaks down. For running the code again you have to make changes in two places. One at the and other at
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "")
After doing this, you will get rid of the empty secret code error.

  • After this, you may face the ‘module not found’ error. For solving this, just use a dot before the name of the module that you are importing.
from .base import *
After this, the runserver command will work.

Thanks for reading. Do comment your views.

Please share your Feedback:

Did you enjoy reading or think it can be improved? Don’t forget to leave your thoughts in the comments section below! If you liked this article, please share it with your friends, and read a few more!

We don't share your details with others