Nginx+uWSGI+Django安装过程中遇到的问题

一、安装uwsgi
最好通过python pip安装uwsgi:
sudo apt-get install python-pip
sudo apt-get install python-dev #不安装这个,下面的安装可能会失败
sudo pip install uwsgi
建议:sudo apt-get install uwsgi uwsgi-core uwsgi-plugin-python#uwsgi-plugin-python一定要安装
测试:
1.test.py
def application(env, start_response):
start_response(‘200 OK’, [(‘Content-Type’,’text/html’)])
return “Hello World”
执行shell命令:
uwsgi –http-socket :8001 –plugin python –wsgi-file test.py
(uwsgi –http :8001 –wsgi-file test.py会出错)
访问网页:
http://127.0.0.1:8001/
看在网页上是否有“Hello World”
参考
stackoverflow:
Ask:
uwsgi –http :8000 –home /home/cuser/.virtualenvs/vq –chdir /var/www/sid/sid -w wsgi.py
uwsgi: option ‘–http’ is ambiguous
getopt_long() error
Answer:
This is most likely because you have uwsgi installed from your distributions packaged binaries, which are more minimal in their build and lack some of the plugins.
You can fix this by either pip install uwsgi and replace uwsgi with path/to/uwsgi/binary/installed/using/pip. You can find that using pip show uwsgi.
[Please note: use pip3 if you’re using python3]
Another method would be to download the respective http/python3 plugins and running the following command:
uwsgi –plugins http,python –http :8000 –home /home/cuser/.virtualenvs/vq –chdir /var/www/sid/sid -w wsgi.py

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值