解决django+gunicorn在服务器有python2和python3安装gunicorn问题

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/pingfan2014/article/details/85208261

一般在ubuntu16.04上只有python2 或者python3安装gunicorn,通过

 pip install gunicorn 是可以安装成功的。

但是,有时系统有python2 和python3 安装gunicorn 是不会成功的。

通过查阅资料:找到如下解决措施:

  apt-get remove gunicorn 

  pip uninstall gunicorn 

  pip3 uninstall gunicorn 

pip3 install git+https://github.com/benoitc/gunicorn.git

上述黑体的解决方法好像不行。

采用下列解决方法:

 apt-get install gunicorn3 

gunicorn3 -w4 -b127.0.0.1:8003 ac.wsgi  #(ac.wsgi为ac文件夹下的wsgi.py)

参考的主要链接:https://stackoverflow.com/questions/23928213/how-to-get-gunicorn-to-use-python-3-instead-of-python-2-502-bad-gateway

问题2:
ImportError: No module named 'ac.wsqi'
[2018-12-24 10:35:29 +0800] [4152] [INFO] Worker exiting (pid: 4152)
[2018-12-24 10:35:29 +0800] [4149] [INFO] Shutting down: Master
[2018-12-24 10:35:29 +0800] [4149] [INFO] Reason: Worker failed to boot.

备注:ImportError: No module named 'ac.wsqi' 为项目ac下的wsqi.py文件

解决方法:在终端输入:

 export PYTHONPATH=/home/sun/Desktop/acc/ac  

其中的/home/sun/Desktop/acc/ac  为wsqi.py的文件夹

参考链接:https://www.cnblogs.com/sudawei/p/3467919.html

猜你喜欢

转载自blog.csdn.net/pingfan2014/article/details/85208261