Forums

local_settings.py; modulenotfounderror

I'm attempting to hide sensitive information in settings.py by creating a local_settings.py module. It is at the same level as settings.py.

  • https://www.pythonanywhere.com/forums/topic/28194/

When executing python manage.py collectstatic from the PythonAnywhere console the following errors are being raised:

python manage.py collectstatic
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/django/core/management/__init__.py", line 259, in fetch_command
app_name = commands[subcommand]
KeyError: 'collectstatic'

During handling of the above exception, another exception occurred:
....
....

 File "/home/ittybitty/django_stackoverflow/stackoverflow_clone/settings.py", line 16, in <module>
from .local_settings import *
ModuleNotFoundError: No module named 'stackoverflow_clone.local_settings'

I'm lost as to why I'm experiencing a problem with this when I've read countless posts online about going though with this approach of using a local_settings.py file when it comes to senisitive information.

Directory

Check this help page for some tips on debugging module not found errors.