2017-06-14 52 views
0

我有一个Django项目目前已使用以下配置中运行:uWSGI和Python> 3.4

  • Debian的8
  • 的Python 3.4
  • uWSGI在皇帝模式

我安装了Python 3.6 .1从源代码创建一个新的虚拟环境与Python 3.6(我使用virtualenvwrapper),但我似乎有一些麻烦让项目启动与uwsgi。

配置文件如下:

[uwsgi] 
plugins = python3 
project = %n 
module = myapp.wsgi:application 
home = path_to_new_env 
socket = /var/run/uwsgi-%n.sock 
chdir = path_to_new_env/myapp/myapp 
processes = 4 
max-requests = 5000 
chmod-socket = 666 
chown-socket = user:user 
master = True 
vacuum = True 
logto = /var/log/%n_LOG.log 
buffer-size = 32768 

我的印象是,python3插件将包括蟒蛇3.6的支持,但该日志表明仍在使用了Python 3.4.x解释。

在我安装的uwsgi插件列表中,我看到了对python 2,3和3.4的支持,但仅此而已。我不确定需要做什么才能在启动时设置正确的解释器。

任何意见,将不胜感激。

更新:我已经尝试建立一个uwsgi插件的Python 3.6:

[email protected]:~# PYTHON=python3.6 uwsgi --build-plugin "/root/uwsgi-2.0.15/plugins/python python36" 
*** uWSGI building and linking plugin from /root/uwsgi-2.0.15/plugins/python *** 
[gcc -pthread] python36_plugin.so 
/root/uwsgi-2.0.15/plugins/python/python_plugin.c: In function ‘uwsgi_python_atexit’: 
/root/uwsgi-2.0.15/plugins/python/python_plugin.c:380:11: error: ‘struct uwsgi_server’ has no member named ‘skip_atexit_teardown’ 
    if (uwsgi.skip_atexit_teardown) 
     ^
/root/uwsgi-2.0.15/plugins/python/python_plugin.c: At top level: 
/root/uwsgi-2.0.15/plugins/python/python_plugin.c:2018:2: error: unknown field ‘worker’ specified in initializer 
    .worker = uwsgi_python_worker, 
^
/root/uwsgi-2.0.15/plugins/python/python_plugin.c:2018:2: error: initialization from incompatible pointer type [-Werror] 
/root/uwsgi-2.0.15/plugins/python/python_plugin.c:2018:2: error: (near initialization for ‘python36_plugin.exception_class’) [-Werror] 
/root/uwsgi-2.0.15/plugins/python/python_plugin.c:2018:2: error: initialized field overwritten [-Werror=override-init] 
/root/uwsgi-2.0.15/plugins/python/python_plugin.c:2018:2: error: (near initialization for ‘python36_plugin.exception_class’) [-Werror=override-init] 
cc1: all warnings being treated as errors 
/root/uwsgi-2.0.15/plugins/python/uwsgi_pymodule.c: In function ‘py_uwsgi_spooler_get_task’: 
/root/uwsgi-2.0.15/plugins/python/uwsgi_pymodule.c:2107:2: error: implicit declaration of function ‘uwsgi_spooler_read_header’ [-Werror=implicit-function-declaration] 
    if (uwsgi_spooler_read_header(task_path, spool_fd, &uh) || 
^
/root/uwsgi-2.0.15/plugins/python/uwsgi_pymodule.c:2108:3: error: implicit declaration of function ‘uwsgi_spooler_read_content’ [-Werror=implicit-function-declaration] 
    uwsgi_spooler_read_content(spool_fd, spool_buf, &body, &body_len, &uh, &task_stat)) { 
^
cc1: all warnings being treated as errors 
*** unable to build python36 plugin *** 

回答

0

解决方案:

1)下载uwsgi源码包

2)按照构建说明here

请注意,对于python3.6,您需要使用--enable-shared标志配置python以及声明一个额外的环境变量be前建设uWsgi插件:export CFLAGS="$CFLAGS -fPIC"

3)支持的插件安装新uwsgi二进制:cp uwsgi /usr/local/bin/