温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

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

发布时间:2020-07-08 17:35:10 来源:网络 阅读:649 作者:andylhz 栏目:建站服务器

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...


向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI