我正在尝试用uwsgi设置烧瓶。 这是我的目录结构:
/srv/http/www/myapp | +-- env -> virtualenv | +-- mpd -> the project directory | +-- main.py -> main application
我正在使用这个命令:
uwsgi -s 127.0.0.1:3002 --chdir webmpd --uid 33 --gid 33 --plugin python -H env --module main --callable app
我得到这个错误:
*** Starting uWSGI 1.9.19 (32bit) on [Sat Nov 30 22:37:33 2013] *** compiled with version: 4.7.2 on 13 November 2013 15:40:36 os: Linux-3.10.19-3-ARCH #1 PREEMPT Thu Nov 21 20:33:10 CST 2013 nodename: raspy machine: armv6l clock source: unix pcre jit disabled detected number of CPU cores: 1 current working directory: /srv/http/www/mpd detected binary path: /usr/bin/uwsgi uWSGI running as root, you can use --uid/--gid/--chroot options setgid() to 33 setuid() to 33 *** WARNING: you are running uWSGI without its master process manager *** your processes number limit is 1321 your memory page size is 4096 bytes detected max file descriptor number: 1024 lock engine: pthread robust mutexes thunder lock: disabled (you can enable it with --thunder-lock) uwsgi socket 0 bound to TCP address 127.0.0.1:3002 fd 3 Python version: 3.3.3 (default, Nov 29 2013, 11:19:14) [GCC 4.7.2] Set PythonHome to env Fatal Python error: Py_Initialize: Unable to get the locale encoding ImportError: No module named 'encodings' Aborted
我已经看了很多,这个问题似乎是源于uwsgi和系统之间的python版本不匹配,但在我的情况下,都运行python 3.3。 我不知道还有什么可能是错的。
任何帮助表示赞赏。
我不知道如果你解决了你的问题,因为(我希望你),但问题来自于你的Python环境没有find正确的。
所以你应该使用你设置在“env”的python环境的绝对path
简而言之:使用这个命令行
uwsgi -s 127.0.0.1:3002 --chdir webmpd --uid 33 --gid 33 --plugin python -H /srv/http/www/myapp/env --module main --callable app
请确定运行uwsgi的用户有权访问此path。
我希望它有帮助!