美文网首页
django+uwsgi : no python applica

django+uwsgi : no python applica

作者: Jayce_xi | 来源:发表于2019-04-01 16:11 被阅读0次

原文出自 BioIT ------------------------------------------> 原文链接

这篇文章解释的特别好--> uwsgi no python application found错误的解决(python3+centos7)

1. 错误

virtualenv环境中启动uWSGI 后,访问报错:

no python application found, check your startup logs for errors

2.解决

这里的问题是,当执行wsgi.py时,它缺少来自virtualenv的site-packages包。如果你已经激活了你的virtualenv,并完成了pip install django那么一切都很好。你有必要的django p ackages。你必须将你的项目目录和你的virtualenv站点包附加到sys.path列表。

# =====================

# wsgi.py file begin 
import os, sys
# add the hellodjango project path into the sys.path
sys.path.append('<PATH_TO_MY_DJANGO_PROJECT>/hellodjango')  # 添加你的项目绝对路径
# sys.path.append('/sdb/pyweb/djcode/website')


# add the virtualenv site-packages path to the sys.path
sys.path.append('<PATH_TO_VIRTUALENV>/Lib/site-packages')  # 添加你虚拟环境包绝对路径
# sys.path.append('/sdb/pyweb/djcode/lib/python2.7/site-packages')


# poiting to the project settings
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "hellodjango.settings")

from django.core.wsgi import get_wsgi_application

application = get_wsgi_application()


# wsgi.py file end
# ===================

相关文章

网友评论

      本文标题:django+uwsgi : no python applica

      本文链接:https://www.haomeiwen.com/subject/bqivbqtx.html