Django框架代码和nginx的整合部署

建站服务器

1. nginx

创新互联专注于筠连网站建设服务及定制,我们拥有丰富的企业做网站经验。 热诚为您提供筠连营销型网站建设,筠连网站制作、筠连网页设计、筠连网站官网定制、微信平台小程序开发服务,打造筠连网络公司原创品牌,更为您提供筠连网站排名全网营销落地服务。

安装不在此阐述,直接上关键配置

server {

listen 80;

server_name _;

access_log /var/log/nginx/platform_admin.log main;

error_log /var/log/nginx/platform_admin_err.log ;

location /static {

root /var/www/platform_admin/resources/;

}

location / {

uwsgi_pass 127.0.0.1:9999;

include uwsgi_params;

}

}

2.python文件解析使用UWSGI,安装不阐述

[uwsgi]

uid = root

gid = root

pidfile = /run/uwsgi/uwsgi.pid

emperor = /etc/uwsgi.d

stats = /run/uwsgi/stats.sock

chmod-socket = 660

emperor-tyrant = true

socket = 127.0.0.1:9999

master = true

processes = 4

env DJANGO_SETTINGS_MODULE=platform_admin.settings

chdir = /var/www/platform_admin

wsgi-file = /var/www/platform_admin/platform_admin/wsgi.py

module = platform_admin.wsgi:application

profiler = true

memory-report = true

enable-threads = true

logdata = true

limit-as = 6048

daemonize = /var/log/django_uwsgi.log

3.启动UWSGI

# /etc/init.d/uwsgi status

查看状态

#/etc/init.d/uwsgi status

uwsgi (pid 10596 10595 10594 10593 10591 10590) is running...


本文标题:Django框架代码和nginx的整合部署
转载来于:http://pwwzsj.com/article/cjpioi.html