python2.7安装和uwsgi

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python2.7安装和uwsgi相关的知识,希望对你有一定的参考价值。

python2.7安装和uwsgi 

tar zxf Python-2.7.13xxxx# 这里,必须用–enable-shared,生成动态库,否则会遇到wsgi不能编译的问题。

 

Bonus: multiple Python versions for the same uWSGI binary

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:

make PROFILE=nolang

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:

PYTHON=python3.4 ./uwsgi --build-plugin "plugins/python python34"
PYTHON=python2.7 ./uwsgi --build-plugin "plugins/python python27"
PYTHON=python2.6 ./uwsgi --build-plugin "plugins/python python26"

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.

[uwsgi]
plugins-dir = <path_to_your_plugin_directory>
plugin = python26

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


以上是关于python2.7安装和uwsgi的主要内容,如果未能解决你的问题,请参考以下文章

uwsgi选定python版本

Nginx+uwsgi+virtualenv+Django+Mysql架构

nginx+uwsgi+django1.9+mysql+python2.7部署到CentOS6.5

python版本随意切换之python2.7+django1.8.7+uwsgi+nginx源码包部署。

CentOS+nginx+uwsgi+Python 多站点环境搭建

django+uwsgi+nginx部署