第一步:安装uwsgi
pip install uwsgi
第二步:编写uwsgi文件
因为django中有此文件拷贝出来即可
进入项目文件目录中
cp django_3/wsgi.py ../
第三步编写xml文件
django_socket.xml
<uwsgi>
<socket>:8077</socket>
<chdir>/data/program/eddy/django_3</chdir>
<module>wsgi</module>
<processes>4</processes> <!-- 进程数 -->
<daemonize>uwsgi.log</daemonize>
</uwsgi>
第四步:启动uwsgi
/data/program/python27/bin/uwsgi -x django_socket.xml
#/data/program/python27/bin/uwsgi -x django_socket.xml --touch-reload=/data/program/eddy/django_3/uwsgi.refresh --pidfile=/data/program/eddy/django_3/uwsgi.pid
第五步:安装nginx并配置
nginx.conf
server {
listen 80;
server_name localhost;
location / {
include uwsgi_params;
uwsgi_pass 127.0.0.1:8077;
}
location /static/ {
alias /data/program/eddy/django_3/templates/static/;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
第六步:启动nginx
现在即可访问网页了 127.0.0.1/index.html
转载于:https://my.oschina.net/eddylinux/blog/551747