码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2017-05-27 18:00:30      阅读:156      评论:0      收藏:0      [点我收藏+]

标签: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...


本文出自 “影子骑士” 博客,请务必保留此出处http://andylhz2009.blog.51cto.com/728703/1930306

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

标签:django nginx

原文地址:http://andylhz2009.blog.51cto.com/728703/1930306

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!