使用mod\wsgi在apache2上提供Django时出错:没有名为settings的模块

2024-10-02 02:24:42 发布

您现在位置:Python中文网/ 问答频道 /正文

错误日志重新启动时有1个请求,由于某种原因它似乎无法加载“中间件”?对于设置,以及一般设置文件。这是不是和权限有关,或者只是我的配置?在

[Wed Jul 03 22:44:42 2013] [notice] Apache/2.2.14 (Ubuntu) mod_wsgi/2.8 Python/2.6.5 configured -- resuming normal operations
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252] mod_wsgi (pid=6165): Exception occurred processing WSGI script '/srv/www/quickerhub.com/interest/django.wsgi'.
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252] Traceback (most recent call last):
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252]   File "/usr/local/lib/python2.6/dist-packages/Django-1.5.1-py2.6.egg/django/core/handlers/wsgi.py", line 236, in __call__
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252]     self.load_middleware()
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252]   File "/usr/local/lib/python2.6/dist-packages/Django-1.5.1-py2.6.egg/django/core/handlers/base.py", line 45, in load_middleware
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252]     for middleware_path in settings.MIDDLEWARE_CLASSES:
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252]   File "/usr/local/lib/python2.6/dist-packages/Django-1.5.1-py2.6.egg/django/conf/__init__.py", line 53, in __getattr__
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252]     self._setup(name)
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252]   File "/usr/local/lib/python2.6/dist-packages/Django-1.5.1-py2.6.egg/django/conf/__init__.py", line 48, in _setup
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252]     self._wrapped = Settings(settings_module)
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252]   File "/usr/local/lib/python2.6/dist-packages/Django-1.5.1-py2.6.egg/django/conf/__init__.py", line 134, in __init__
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252]     raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e))
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252] ImportError: Could not import settings 'settings' (Is it on sys.path?): No module named settings
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252] mod_wsgi (pid=6166): Exception occurred processing WSGI script '/srv/www/quickerhub.com/interest/django.wsgi'.
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252] Traceback (most recent call last):
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252]   File "/usr/local/lib/python2.6/dist-packages/Django-1.5.1-py2.6.egg/django/core/handlers/wsgi.py", line 236, in __call__
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252]     self.load_middleware()
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252]   File "/usr/local/lib/python2.6/dist-packages/Django-1.5.1-py2.6.egg/django/core/handlers/base.py", line 45, in load_middleware
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252]     for middleware_path in settings.MIDDLEWARE_CLASSES:
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252]   File "/usr/local/lib/python2.6/dist-packages/Django-1.5.1-py2.6.egg/django/conf/__init__.py", line 53, in __getattr__
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252]     self._setup(name)
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252]   File "/usr/local/lib/python2.6/dist-packages/Django-1.5.1-py2.6.egg/django/conf/__init__.py", line 48, in _setup
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252]     self._wrapped = Settings(settings_module)
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252]   File "/usr/local/lib/python2.6/dist-packages/Django-1.5.1-py2.6.egg/django/conf/__init__.py", line 134, in __init__
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252]     raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e))
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252] ImportError: Could not import settings 'settings' (Is it on sys.path?): No module named settings

我的文件结构:

^{pr2}$

我的django.wsgi公司:已编辑

import os
import sys

sys.path.append('/srv/www/quickerhub.com/')

os.environ['DJANGO_SETTINGS_MODULE'] = 'interest.settings'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

我的httpd.conf公司名称:

WSGIScriptAlias / /srv/www/quickerhub.com/interest/django.wsgi

<Directory /srv/www/quickerhub.com>
Order allow,deny
Allow from all
</Directory> 

我的网站已启用/quickerhub.com网站公司名称:

WSGIPythonPath /srv/www/quickerhub.com
<VirtualHost *:80>
    ServerName quickerhub.com
    ServerAlias testing.quickerhub.com

    Alias /static/ /srv/www/quickerhub.com/interest/static/
    # Alias /sitemap.xml /srv/www/quickerhub.com/interest/static/sitemap.xml
    WSGIScriptAlias / /srv/www/quickerhub.com/interest/django.wsgi

    <Directory />
        AllowOverride None
        Options -Indexes
    </Directory>

    <Directory /srv/www/quickerhub.com/.git/>
        Deny From All
    </Directory>

</VirtualHost>

Tags: djangoincomclientwsgisettingsusrlocal

热门问题