I've been following the Wiki:
https://www.pythonanywhere.com/wiki/How%20to%20use%20Mezzanine%20on%20PythonAnywhere
ImportError: Could not import settings 'MexLavuBlog.settings' (Is it on sys.path? Is there an import error in the settings file?): No module named 'MexLavuBlog'
This is the full backtrace of the error I get:
2015-05-04 22:38:56,871 :Traceback (most recent call last):
2015-05-04 22:38:56,871 : File "/usr/local/lib/python3.4/dist-packages/django/conf/__init__.py", line 128, in __init__
2015-05-04 22:38:56,871 : mod = importlib.import_module(self.SETTINGS_MODULE)
2015-05-04 22:38:56,871 : File "/home/MexLavu/.virtualenvs/mezzanine/lib/python3.4/importlib/__init__.py", line 109, in import_module
2015-05-04 22:38:56,871 : return _bootstrap._gcd_import(name[level:], package, level)
2015-05-04 22:38:56,872 : File "<frozen importlib._bootstrap>", line 2231, in _gcd_import
2015-05-04 22:38:56,872 : File "<frozen importlib._bootstrap>", line 2214, in _find_and_load
2015-05-04 22:38:56,872 : File "<frozen importlib._bootstrap>", line 2189, in _find_and_load_unlocked
2015-05-04 22:38:56,872 : File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
2015-05-04 22:38:56,873 : File "<frozen importlib._bootstrap>", line 2231, in _gcd_import
2015-05-04 22:38:56,873 : File "<frozen importlib._bootstrap>", line 2214, in _find_and_load
2015-05-04 22:38:56,873 : File "<frozen importlib._bootstrap>", line 2201, in _find_and_load_unlocked
2015-05-04 22:38:56,873 :ImportError: No module named 'MexLavuBlog'
2015-05-04 22:38:56,873 :
2015-05-04 22:38:56,873 :During handling of the above exception, another exception occurred:
2015-05-04 22:38:56,874 :
2015-05-04 22:38:56,874 :Traceback (most recent call last):
2015-05-04 22:38:56,874 : File "/bin/user_wsgi_wrapper.py", line 130, in __call__
2015-05-04 22:38:56,874 : self.error_log_file.logger.exception("Error running WSGI application")
2015-05-04 22:38:56,874 : File "/usr/lib/python3.4/logging/__init__.py", line 1296, in exception
2015-05-04 22:38:56,874 : self.error(msg, *args, **kwargs)
2015-05-04 22:38:56,875 : File "/usr/lib/python3.4/logging/__init__.py", line 1289, in error
2015-05-04 22:38:56,875 : self._log(ERROR, msg, args, **kwargs)
2015-05-04 22:38:56,875 : File "/usr/lib/python3.4/logging/__init__.py", line 1395, in _log
2015-05-04 22:38:56,876 : self.handle(record)
2015-05-04 22:38:56,876 : File "/usr/lib/python3.4/logging/__init__.py", line 1404, in handle
2015-05-04 22:38:56,876 : if (not self.disabled) and self.filter(record):
2015-05-04 22:38:56,876 : File "/usr/lib/python3.4/logging/__init__.py", line 692, in filter
2015-05-04 22:38:56,877 : for f in self.filters:
2015-05-04 22:38:56,877 : File "/bin/user_wsgi_wrapper.py", line 122, in __call__
2015-05-04 22:38:56,877 : app_iterator = self.app(environ, start_response)
2015-05-04 22:38:56,877 : File "/usr/local/lib/python3.4/dist-packages/django/core/handlers/wsgi.py", line 187, in __call__
2015-05-04 22:38:56,877 : self.load_middleware()
2015-05-04 22:38:56,877 : File "/usr/local/lib/python3.4/dist-packages/django/core/handlers/base.py", line 44, in load_middleware
2015-05-04 22:38:56,878 : for middleware_path in settings.MIDDLEWARE_CLASSES:
2015-05-04 22:38:56,878 : File "/usr/local/lib/python3.4/dist-packages/django/conf/__init__.py", line 54, in __getattr__
2015-05-04 22:38:56,878 : self._setup(name)
2015-05-04 22:38:56,878 : File "/usr/local/lib/python3.4/dist-packages/django/conf/__init__.py", line 49, in _setup
2015-05-04 22:38:56,878 : self._wrapped = Settings(settings_module)
2015-05-04 22:38:56,878 : File "/usr/local/lib/python3.4/dist-packages/django/conf/__init__.py", line 132, in __init__
2015-05-04 22:38:56,878 : % (self.SETTINGS_MODULE, e)
2015-05-04 22:38:56,879 :ImportError: Could not import settings 'MexLavuBlog.settings' (Is it on sys.path? Is there an import error in the settings file?): No module named 'MexLavuBlog'
I've also edited the example WSGI file becasue execfile
is not supported in Python3.4, the django WSGI import becuase it's Django > 1.5 and the os.environ
as in the wsgi.py
file generated by mezzanine-project
:
# activate virtualenv before we do anything else
activate_this = '/home/MexLavu/.virtualenvs/mezzanine/bin/activate_this.py'
exec(open(activate_this).read(), dict(__file__=activate_this))
import os
import sys
# add project folder and its parent folder to path. mezzanine needs both.
for path in ['/home/MexLavu', '/home/MexLavu/src/MexLavuBlog']:
if path not in sys.path:
sys.path.append(path)
# specify django settings
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "MexLavuBlog.settings")
# load default django wsgi app
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()