本文介绍了不能得到gunicorn使用Python 3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有Ubuntu + NGINX + Gunicorn的虚拟环境,与Python 3的设置一起工作,但我的Flask应用程序仍然运行为2.7.6。我有条不紊地按照指示,但我找不到解决方案。


$ b Gunicorn配置文件

  [program:app-server] 
command = gunicorn app:app -b localhost:8000
directory = / home / www / app-server
user = appuser

项目目录结构



pre code app-server
----app.py
---- venv(虚拟环境)


解决方案

Gunicorn本身就是一个Python应用程序, Gunicorn PPA只发布Python 2版本。您可以将Gunicorn安装到Python 3中(使用 pip

/ code>,最好进入你的virtualenv)并运行该版本:

  / home / www / app-server / venv / bin / gunicorn 


I have Ubuntu+NGINX+Gunicorn with a virtual environment that works with Python 3 setup but my Flask app still runs as 2.7.6. I have methodically followed the instructions but I cannot find a resolution.

Gunicorn config file

[program:app-server]
command = gunicorn app:app -b localhost:8000
directory = /home/www/app-server
user = appuser

Project directory structure

app-server    
----app.py
----venv (virtual environment)
解决方案

Gunicorn is itself a Python application; the Gunicorn PPA only publishes Python 2 versions.

You'd install Gunicorn into Python 3 instead (using pip, preferably into your virtualenv) and run that version:

/home/www/app-server/venv/bin/gunicorn

这篇关于不能得到gunicorn使用Python 3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-22 20:50