【发布时间】:2015-02-19 18:03:52
【问题描述】:
我有 Ubuntu+NGINX+Gunicorn 和一个虚拟环境,可与 Python 3 设置一起使用,但我的 Flask 应用程序仍以 2.7.6 运行。我有条不紊地按照说明进行操作,但找不到解决方法。
Gunicorn 配置文件
[program:app-server]
command = gunicorn app:app -b localhost:8000
directory = /home/www/app-server
user = appuser
项目目录结构
app-server
----app.py
----venv (virtual environment)
【问题讨论】:
-
这看起来更像是一个supervisord配置而不是gunicorn配置文件。
-
您需要使用
pip3(或有时pip3.4)安装它。所以运行pip uninstall gunicorn(如果你不需要python 2.6/2.7 版本),然后运行pip3 install gunicorn。如果您忽略了该卸载部分,或者因为它不是您的服务器而不允许这样做,请不要担心,只需运行which gunicorn -a。您使用的可能不是正确的。之前(在 CentOS 上)我不得不使用类似/opt/python-3.4.2/bin/gunicorn的东西。我知道你说的是 Ubuntu,但你永远不知道!
标签: python-3.x flask gunicorn