Thursday, November 20, 2014

Could not import settings

I am setting up a new django project and I'm getting the dreaded
'Could not import settings' error. I've set up many django projects
before, and never had this problem. The differences with this one is
that it's using python3.4, django 1.7, and it's on a VM (all my others
were on <1.7, python 2 and a physical host). I've googled this and
it's asked a lot, but none of the solutions work for me.

This is the error I'm getting:

vagrant@vagrant:/vagrant/elex_apis$ python3 manage.py migrate
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/django/conf/__init__.py",
line 94, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/lib/python3.4/importlib/__init__.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 2231, in _gcd_import
File "<frozen importlib._bootstrap>", line 2214, in _find_and_load
File "<frozen importlib._bootstrap>", line 2189, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 2231, in _gcd_import
File "<frozen importlib._bootstrap>", line 2214, in _find_and_load
File "<frozen importlib._bootstrap>", line 2201, in _find_and_load_unlocked
ImportError: No module named '/vagrant/elex_apis/elex_apis/settings'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.4/dist-packages/django/core/management/__init__.py",
line 385, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.4/dist-packages/django/core/management/__init__.py",
line 345, in execute
settings.INSTALLED_APPS
File "/usr/local/lib/python3.4/dist-packages/django/conf/__init__.py",
line 46, in __getattr__
self._setup(name)
File "/usr/local/lib/python3.4/dist-packages/django/conf/__init__.py",
line 42, in _setup
self._wrapped = Settings(settings_module)
File "/usr/local/lib/python3.4/dist-packages/django/conf/__init__.py",
line 98, in __init__
% (self.SETTINGS_MODULE, e)
ImportError: Could not import settings
'/vagrant/elex_apis/elex_apis/settings.py' (Is it on sys.path? Is
there an import error in the settings file?): No module named
'/vagrant/elex_apis/elex_apis/settings'


I'm checked all the usual things (The settings file is there, it's
readable, I have an __init__,py file, my wsgi.py is good, my manage.py
is good, and I can import it)

vagrant@vagrant:/vagrant/elex_apis$ python3
Python 3.4.0 (default, Apr 11 2014, 13:05:11)
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import elex_apis.settings
>>>


Any assistance will be greatly appreciated.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CACwCsY6mb3xsYDnqZ%2B6j87mydevD6VNYrfTifsiCVttfktQjyQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment