Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
292 views
in Technique[技术] by (71.8m points)

python - Could not import settings 'myproject.settings' (Is it on sys.path?): No module named pinax

I'm trying to get pinax working on WebFaction and having so many issues...

[Sun Feb 19 20:01:20 2012] [error] [client 127.0.0.1] mod_wsgi (pid=22796): Exception occurred processing WSGI script '/home/pawesome/webapps/qtsocial/myproject.wsgi'.
[Sun Feb 19 20:01:20 2012] [error] [client 127.0.0.1] Traceback (most recent call last):
[Sun Feb 19 20:01:20 2012] [error] [client 127.0.0.1]   File "/home/pawesome/webapps/qtsocial/lib/python2.6/django/core/handlers/wsgi.py", line 250, in __call__
[Sun Feb 19 20:01:20 2012] [error] [client 127.0.0.1]     self.load_middleware()
[Sun Feb 19 20:01:20 2012] [error] [client 127.0.0.1]   File "/home/pawesome/webapps/qtsocial/lib/python2.6/django/core/handlers/base.py", line 39, in load_middleware
[Sun Feb 19 20:01:20 2012] [error] [client 127.0.0.1]     for middleware_path in settings.MIDDLEWARE_CLASSES:
[Sun Feb 19 20:01:20 2012] [error] [client 127.0.0.1]   File "/home/pawesome/webapps/qtsocial/lib/python2.6/django/utils/functional.py", line 276, in __getattr__
[Sun Feb 19 20:01:20 2012] [error] [client 127.0.0.1]     self._setup()
[Sun Feb 19 20:01:20 2012] [error] [client 127.0.0.1]   File "/home/pawesome/webapps/qtsocial/lib/python2.6/django/conf/__init__.py", line 42, in _setup
[Sun Feb 19 20:01:20 2012] [error] [client 127.0.0.1]     self._wrapped = Settings(settings_module)
[Sun Feb 19 20:01:20 2012] [error] [client 127.0.0.1]   File "/home/pawesome/webapps/qtsocial/lib/python2.6/django/conf/__init__.py", line 89, in __init__
[Sun Feb 19 20:01:20 2012] [error] [client 127.0.0.1]     raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e))
[Sun Feb 19 20:01:20 2012] [error] [client 127.0.0.1] ImportError: Could not import settings 'myproject.settings' (Is it on sys.path?): No module named pinax

The wsgi:

import os
import sys

from django.core.handlers.wsgi import WSGIHandler

os.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings'
application = WSGIHandler()

The wsgi is in the same folder as myproject and settings.py is definitely in myproject. So what gives?

EDIT:

Okay so I took the advice from here as well as from webfaction and the wsgi now looks like this...

import os
import sys
from site import addsitedir
from django.core.handlers.wsgi import WSGIHandler

os.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings'
sys.path.append('/home/pawesome/webapps/qtsocial/myproject')
sys.path.append('/home/pawesome/webapps/qtsocial')

addsitedir('/home/pawesome/envs/pinax072/lib/python2.6/site-packages')
application = WSGIHandler()

I think this has solved something but not everything... now I am getting...

[Sun Feb 19 20:00:28 2012] [error] [client 127.0.0.1] mod_wsgi (pid=15572): Exception occurred processing WSGI script '/home/pawesome/webapps/qtsocial/myproject.wsgi'.
[Sun Feb 19 20:00:28 2012] [error] [client 127.0.0.1] Traceback (most recent call last):
[Sun Feb 19 20:00:28 2012] [error] [client 127.0.0.1]   File "/home/pawesome/webapps/qtsocial/lib/python2.6/django/core/handlers/wsgi.py", line 250, in __call__
[Sun Feb 19 20:00:28 2012] [error] [client 127.0.0.1]     self.load_middleware()
[Sun Feb 19 20:00:28 2012] [error] [client 127.0.0.1]   File "/home/pawesome/webapps/qtsocial/lib/python2.6/django/core/handlers/base.py", line 47, in load_middleware
[Sun Feb 19 20:00:28 2012] [error] [client 127.0.0.1]     raise exceptions.ImproperlyConfigured('Error importing middleware %s: "%s"' % (mw_module, e))
[Sun Feb 19 20:00:28 2012] [error] [client 127.0.0.1] ImproperlyConfigured: Error importing middleware django_openid.consumer: "No module named voting_extras"

Thanks again guys... The people at WebFaction have recently given up and told me to come here even though I already had lol

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

In your terminal, cd into the directory that contains settings.py, then run

python settings.py

You may get an import error that is easily fixed (typing error, or syntax error).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...