As we have seen, uWSGI is composed of a small core and various plugins. Plugins can be embedded in the binary or loaded dynamically. When you build uWSGI for Python, a series of plugins plus the Python one are embedded in the final binary.

This could be a problem if you want to support multiple Python versions without building a binary for each one.

The best approach would be having a little binary with the language-independent features built in, and one plugin for each Python version that will be loaded on-demand.

In the uWSGI source directory:

This will build a uwsgi binary with all the default plugins built-in except the Python one.

Now, from the same directory, we start building Python plugins:

You will end up with three files: python34_plugin.so, python27_plugin.so, python26_plugin.so. Copy these into your desired directory. (By default, uWSGI searches for plugins in the current working directory.)

Now in your configurations files you can simply add (at the very top) the plugins-dir and plugin directives.

This will load the python26_plugin.so plugin library from the directory into which you copied the plugins.

From: Quickstart for Python/WSGI applications

2 条评论

  • 黄先生 2017-07-24 回复

    我想问问,为什么我按照上面的步骤编译了一个python 3.5的二进制包,引入成功,但是我看日志显示的还是python2.7的?

    • Henry 2017-08-09 回复 作者



电子邮件地址不会被公开。 必填项已用*标注