Solve local settings not being imported from settings.py in Django


Usually we create local_settings.py for overwrite settings.py configuration due to environment or custom conditions.
We can put local_settings.py into django project that have same place with settings.py.
To load local_settings.py, we can use :

1
2
3
4
try:
    from local_settings import *
except ImportError:
    pass

But problem come when local_settings not being called by settings.py.
This problem usually because you have import python modules in local_settings but it’s doesn’t installed.

To test, open your django shell (python manage.py shell) and import local_settings.

1
2
python manage.py shell
import local_settings

Then you will see error which python module that not installed 🙂


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.