I get an import error when I try to run a script in my Django application.
This is due to the settings file.
Error:
File "bookd/get_data.py", line 10, in <module> from models import UserProfile File "/home/hiccup/DataProjects/goodread/bookda/bookd/models.py", line 3, in <module> from django.db import models File "/usr/local/lib/python2.7/dist-packages/django/db/__init__.py", line 14, in <module> if not settings.DATABASES: File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 276, in __getattr__ self._setup() File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 42, in _setup self._wrapped = Settings(settings_module) File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 89, in __init__ raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e)) ImportError: Could not import settings 'bookda.settings' (Is it on sys.path?): No module named bookda.settings
I know that this is a very simple error, and there are answers to its solution, but I just can not solve it, no matter how I try to add the path to the settings. And it's pretty frustrating that other django applications on my system work just fine.
Hierarchy:
bookda/settings.py bookda/books/script.py
I get an error when running script.py.
source share