nginx + uwsgi + django“无法导入设置”

时间:2014-01-13 19:52:09

标签: django ubuntu nginx uwsgi

好的,我一定是这么傻但是我无法弄清楚如何让这个工作,我有将近两个小时,我不能再进步了,老实说我不知道​​什么是错的,我读了很多指南,我我做的一切都很好..

但是让我们把你的配置贴上你的话:

dir struct:

├── apps
├── config
    └── wsgi.py
    ├── settings.py
├── dev
├── env
├── static
│   ├── css
│   ├── img
│   └── js
│       └── vendor
└── templates
    ├── admin
    │   └── supervisor
    └── base
├── manage.py

wsgi.py

import os
import sys

from site import addsitedir
from os.path import abspath, dirname, join

sys.path.insert(0, abspath(join(dirname(__file__), "..")))
sys.path.insert(0, abspath(join(dirname(__file__), "../apps")))
sys.path.insert(1, abspath(join(dirname(__file__), "../config")))

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

backoffice.ini

[uwsgi]
chdir = /var/www/backoffice
mountpoint = /var/www/backoffice
gid = www-data
uid = www-data
socket = /tmp/uwsgi.backoffice.sock
virtualenv = /var/www/backoffice/env
plugins = python
master = True
chmod-socket = 666
memory-report = 1
harakiri = 20
processes = 4
profiler = 1
pythonpath = /var/www/backoffice
vacuum = True
max-requests = 5000

然后我运行以下命令:

uwsgi --ini /var/www/backoffice/backoffice.ini -b 32000 --wsgi-file /var/www/backoffice /config/wsgi.py

我得到错误“无法导入它在sys.path上的设置”当然是!!

sys.path中

['/var/www/backoffice/', '.', '', '/var/www/backoffice/env/local/lib/python2.7/site-packages/distribute-0.6.34-py2.7.egg', '/var/www/backoffice/env/local/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg', '/var/www/backoffice/env/src/django-logicaldelete', '/var/www/backoffice/env/lib/python2.7/site-packages/distribute-0.6.34-py2.7.egg', '/var/www/backoffice/env/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg', '/var/www/backoffice/env/lib/python2.7', '/var/www/backoffice/env/lib/python2.7/plat-i386-linux-gnu', '/var/www/backoffice/env/lib/python2.7/lib-tk', '/var/www/backoffice/env/lib/python2.7/lib-old', '/var/www/backoffice/env/lib/python2.7/lib-dynload', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-i386-linux-gnu', '/usr/lib/python2.7/lib-tk', '/var/www/backoffice/env/local/lib/python2.7/site-packages', '/var/www/backoffice/env/lib/python2.7/site-packages']

任何提示?什么是太明显,我没有看到..谢谢

1 个答案:

答案 0 :(得分:0)

我再次检查了一下,并且@ sk1p指出我的设置可能有问题,这在调试深度后是真的,我正在导入翻译库并且导致循环导入问题。

感谢帮助人员