我的 nginx 配置:
location / {
include uwsgi_params;
uwsgi_param UWSGI_PYHOME /usr;
uwsgi_pass unix:/var/run/uwsgi-python/uwsgi/socket;
uwsgi_param UWSGI_CHDIR /var/www/my_site;
uwsgi_param UWSGI_SCRIPT my_site:app;
uwsgi_param SERVER_NAME my_site;
uwsgi_param UWSGI_SETENV DEPLOY_VERSION=Development;
}
我的 uwsgi 段:
/usr/local/bin/uwsgi --master --processes 2 --logdate --chmod-socket=666 --uid www --gid www --limit-as 512 --harakiri 60 --max-requests 1000 --no-orphans —-reload-os-env --daemonize /var/log/uwsgi-python/uwsgi.log --pidfile /var/run/uwsgi-python/uwsgi/pid --socket /var/run/uwsgi-python/uwsgi/socket --xmlconfig /etc/uwsgi-python/apps-enabled/uwsgi.xml
uwsgi xml:
<uwsgi>
<master/>
<vhost/>
<memory-report/>
<no-site/>
</uwsgi>
在我的烧瓶应用中
print os.environ.get('DEPLOY_VERSION', 'NONE') #pring NONE
我怎样才能得到 env_vars?
也许我无法在 <vhost/><no-site/> 模式下通过 UWSGI_SETENV 获取 env_vars 设置?
顺便说一句:您如何在一台没有虚拟环境的机器上部署应用程序的多版本(开发/测试版/发布)?