i have what seems to be a basic path problem, but i can't figure this out for the life of me.
I have the following directory structure:
└── rockitt
├── activities
│ ├── migrations
│ ├── templates
│ │ └── activities
│ └── templatetags
├── blog
│ ├── settings
within blog/settings
I have:
base.py dev.py __init.py__
__init.py__
within the directory above contains:
from .dev import *
When running things like manage.py i receive the following error:
ImportError: Could not import settings 'blog.settings' (Is it on sys.path? Is there an import error in the settings file?): No module named settings
What I have tried so far:
I've checked what paths are present when manage.py is running and the following path is at the top of the list:
rockitt lib/python2.7/Django-1.7.7-py2.7.egg lib/python2.7 [other dirs...] ENV/lib/python27.zip ENV/lib/python2.7 ENV/lib/python2.7/plat-linux2 ENV/lib/python2.7/lib-tk ENV/lib/python2.7/lib-old ENV/lib/python2.7/lib-dynload /usr/local/lib/python2.7 /usr/local/lib/python2.7/plat-linux2 /usr/local/lib/python2.7/lib-tk ENV/lib/python2.7/site-packages
I've tried to manually load the settings file with no luck: from the blog/settings directory i have tried (I'm not sure if this is the right way to test this however based on reading this:
>>> import dev Traceback (most recent call last): File "<stdin>", line 1, in <module> File "dev.py", line 1, in <module> from .base import * ValueError: Attempted relative import in non-package
I'm kinda stuck on this. I -=think=- it might be also related to my wsgi.py file (below).
Further info:
wsgi.py:
import os, sys, site site.addsitedir('/home/thisUserName/webapps/dev_django_rockitt/ENV/lib/python2.7/site-packages') os.environ.setdefault("DJANGO_SETTINGS_MODULE", "blog.settings.dev") activate_this = os.path.expanduser("/home/thisUserName/webapps/dev_django_rockitt/ENV/bin/activate_this.py") execfile(activate_this, dict(__file__=activate_this)) #calculate the path based on the location of the WSGI script project = '/home/thisUserName/webapps/dev_django_rockitt/rockitt' workspace = os.path.dirname(project) sys.path.append(workspace) sys.path = ['/home/thisUserName/webapps/dev_django_rockitt/rockitt/blog', '/home/thisUserName/webapps/dev_django_rockitt/rockitt'$ from django.core.wsgi import get_wsgi_application application = get_wsgi_application()
Stacktrace:
Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/home/thisUserName/webapps/dev_django_rockitt/lib/python2.7/Django-1.7.7-py2.7.egg/django/core/management/__init__.py", line 385, in execute_from_command_line utility.execute() File "/home/thisUserName/webapps/dev_django_rockitt/lib/python2.7/Django-1.7.7-py2.7.egg/django/core/management/__init__.py", line 345, in execute settings.INSTALLED_APPS File "/home/thisUserName/webapps/dev_django_rockitt/lib/python2.7/Django-1.7.7-py2.7.egg/django/conf/__init__.py", line 46, in __getattr__ self._setup(name) File "/home/thisUserName/webapps/dev_django_rockitt/lib/python2.7/Django-1.7.7-py2.7.egg/django/conf/__init__.py", line 42, in _setup self._wrapped = Settings(settings_module) File "/home/thisUserName/webapps/dev_django_rockitt/lib/python2.7/Django-1.7.7-py2.7.egg/django/conf/__init__.py", line 98, in __init__ % (self.SETTINGS_MODULE, e) ImportError: Could not import settings 'blog.settings' (Is it on sys.path? Is there an import error in the settings file?): No module named settings