开发者

uwsgi + django import error

I have a problem when I use django with uwsgi with the pythonpath.

I have a django project named 'project' which is the /sites/django/ directory

So to start uwsgi i use this command :

/opt/uwsgi/uwsgi -s 127.0.0.1:9001 -C -M 4 -t 30 -A 4 -p 4 -d /var/log/uwsgi.log --pythonpath '/sites/django/project/' --module wsgi

If I am in the /sites/django/project' it works.

If I start a python shell and I write :

import sys
sys.path.append('/sites/django/project/')
import wsgi

It works too.

But when i launch the uwsgi command outside the /sites/django/project/ I have the error :

ImportError: No module named wsgi

开发者_StackOverflow社区

So I don't know why I have the ImportError : it works in the shell.

If anyone has an idea, Thanks.

Well, i find the answer, it seems it's a bug and i must add the "-i" option (single interpreter mode ) in my command .


The documentation seems to suggest two possibilities.

First, remove the single quotes from the python path argument. Second, the examples on the linked page have --python-path instead of --pythonpath (even though the index at the top of the page says otherwise). Worth trying.


if you're using a virtualenv, you need to pass in the -H flag ( http://projects.unbit.it/uwsgi/wiki/VirtualEnv )

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜