Django: Keeping your directory structure clean

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.

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.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s