问题描述
- 谁能帮帮我,Django部署问题,nginx和uWSGI
- 测试uWSGI是否正常
在django项目的根目录下创建test.py文件,添加源码如下:test.py
def application(env start_response):
start_response('200 OK' [('Content-Type''text/html')])
return [""Hello World""] # python2
#return [b""Hello World""] # python3
然后,Run uWSGI:uwsgi --http :8000 --wsgi-file test.py
根据网上教程 出现以下结果
Python main interpreter initialized at 0x1adf290
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 72760 bytes (71 KB) for 1 cores
*** Operational MODE: single process ***
failed to open python file test.py
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI worker 1 (and the only) (pid: 3029 cores: 1)
请问问题出现在哪????????????
解决方案
1.安装django
python setup.py install
2.安装flup
python setup.py install
3.安装uwsgi
python uwsgiconfig.py --build
python setup.py install
4.创建项目
django-admin.py
startproject Test
vi
uwsgi......
答案就在这里:nginx uwsgi 部署django
解决方案二:
加载的test py文件是否在uwsgi中配置正确路径等