Did you also rename your directory? Python can't handle dashes in module names, and your directory name identifies the module as well.
On 19 March 2014 13:47, Ziwei Zhou <[email protected]> wrote: > Thanks for the reply, now I got this error > > ImportError: Could not import settings 'mezzanine_test.settings' (Is it on > sys.path? Is there an import error in the settings file?): No module named > 'mezzanine_test' > > > On Wednesday, March 19, 2014 11:10:30 AM UTC+8, Stephen McDonald wrote: >> >> The project name needs to be a valid Python package name, which >> "mezzanine-test" isn't since you can't use dashes. >> >> Try "mezzanine_test". >> >> >> On Wed, Mar 19, 2014 at 2:04 PM, Ziwei Zhou <[email protected]> wrote: >>> >>> Hi >>> >>> I have my mezzanine project named as mezzanine-test and located at >>> /sites/test/code/mezzanine-test, inside mezzanine-test folder following are >>> the files. >>> >>> ubuntu@test:/sites/test/code/mezzanine-test$ ls -l >>> >>> total 156 >>> >>> drwxrwxr-x 3 ubuntu ubuntu 4096 Mar 17 19:27 deploy >>> >>> -rwxr-xr-x 1 ubuntu ubuntu 16192 Mar 18 17:55 fabfile.py >>> >>> -rw-r--r-- 1 ubuntu ubuntu 17819 Mar 18 17:56 fabfile.pyc >>> >>> -rw-r--r-- 1 ubuntu ubuntu 276 Mar 18 19:28 gunicorn.conf.py >>> >>> -rw-r--r-- 1 root root 6 Mar 18 19:30 gunicorn.pid >>> >>> -rwxr-xr-x 1 ubuntu ubuntu 0 Mar 16 20:18 __init__.py >>> >>> -rw-r--r-- 1 ubuntu ubuntu 134 Mar 17 18:54 __init__.pyc >>> >>> -rw-rw-r-- 1 ubuntu ubuntu 738 Mar 16 22:00 local_settings.py >>> >>> -rw-rw-r-- 1 ubuntu ubuntu 703 Mar 17 18:54 local_settings.pyc >>> >>> -rwxr-xr-x 1 ubuntu ubuntu 955 Mar 16 20:18 manage.py >>> >>> -rw-r--r-- 1 ubuntu ubuntu 1685 Mar 18 19:22 readme.md >>> >>> -rw-rw-r-- 1 ubuntu ubuntu 401 Mar 18 17:25 requirements.txt >>> >>> -rw-rw-r-- 1 ubuntu ubuntu 16146 Mar 18 18:58 settings.py >>> >>> -rw-rw-r-- 1 ubuntu ubuntu 10311 Mar 18 17:42 settings.pyc >>> >>> drwxrwxr-x 2 ubuntu ubuntu 4096 Mar 17 19:29 static >>> >>> drwxr-xr-x 9 ubuntu ubuntu 4096 Mar 17 03:23 templates >>> >>> -rwxr-xr-x 1 ubuntu ubuntu 4567 Mar 17 22:17 urls.py >>> >>> -rw-r--r-- 1 ubuntu ubuntu 890 Mar 17 18:55 urls.pyc >>> >>> -rwxr-xr-x 1 ubuntu ubuntu 641 Mar 18 19:39 wsgi.py >>> >>> If I run following command >>> >>> /sites/test/code/mezzanine-test$/sites/.virtualenvs/test/bin/gunicorn -c >>> gunicorn.conf.py wsgi:application >>> >>> The project will run but I got following error message when I try to >>> access the site. >>> >>> Traceback (most recent call last): >>> >>> File >>> "/sites/.virtualenvs/test/lib/python3.3/site-packages/gunicorn/workers/sync.py", >>> line 136, in handle_request >>> >>> for item in respiter: >>> >>> File >>> "/sites/.virtualenvs/test/lib/python3.3/site-packages/raven/middleware.py", >>> line 35, in __call__ >>> >>> iterable = self.application(environ, start_response) >>> >>> File >>> "/sites/.virtualenvs/test/lib/python3.3/site-packages/Django-1.6.2-py3.3.egg/django/core/handlers/wsgi.py", >>> line 187, in __call__ >>> >>> self.load_middleware() >>> >>> File >>> "/sites/.virtualenvs/test/lib/python3.3/site-packages/Django-1.6.2-py3.3.egg/django/core/handlers/base.py", >>> line 46, in load_middleware >>> >>> for middleware_path in settings.MIDDLEWARE_CLASSES: >>> >>> File >>> "/sites/.virtualenvs/test/lib/python3.3/site-packages/Django-1.6.2-py3.3.egg/django/conf/__init__.py", >>> line 54, in __getattr__ >>> >>> self._setup(name) >>> >>> File >>> "/sites/.virtualenvs/test/lib/python3.3/site-packages/Django-1.6.2-py3.3.egg/django/conf/__init__.py", >>> line 49, in _setup >>> >>> self._wrapped = Settings(settings_module) >>> >>> File >>> "/sites/.virtualenvs/test/lib/python3.3/site-packages/Django-1.6.2-py3.3.egg/django/conf/__init__.py", >>> line 132, in __init__ >>> >>> % (self.SETTINGS_MODULE, e) >>> >>> ImportError: Could not import settings 'mezzanine-test.settings' (Is it >>> on sys.path? Is there an import error in the settings file?): No module >>> named 'mezzanine-test' >>> >>> >>> The wsgi.py file looks like following >>> >>> from __future__ import unicode_literals >>> import os >>> PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__)) >>> settings_module = "%s.settings" % PROJECT_ROOT.split(os.sep)[-1] >>> os.environ.setdefault("DJANGO_SETTINGS_MODULE", settings_module) >>> from django.core.handlers.wsgi import WSGIHandler >>> application = WSGIHandler() >>> >>> >>> >>> Any help will be greatly appreciated. >>> >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Mezzanine Users" group. >>> To unsubscribe from this group and stop receiving emails from it, send an >>> email to [email protected]. >>> >>> For more options, visit https://groups.google.com/d/optout. >> >> >> >> >> -- >> Stephen McDonald >> http://jupo.org > > -- > You received this message because you are subscribed to the Google Groups > "Mezzanine Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. -- [email protected] -- You received this message because you are subscribed to the Google Groups "Mezzanine Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
