美文网首页
Django 快速部署CentOS,Nginx,uWsgi,Su

Django 快速部署CentOS,Nginx,uWsgi,Su

作者: pokeey | 来源:发表于2018-12-18 01:25 被阅读0次

安装必用包

方式一: shell安装

复制安装包脚本到您的主机

$ vim django_deplyment.sh
$ chmod +x  django_deplyment.sh
$ ./django_deplyment.sh

方式二: 手动安装

安装python3
$ yum -y install python36
安装Git
$ yum -y install git
安装setuptools
$ yum -y install python36-setuptools
安装pip

https://pypi.org/project/pip/
pip 18 下载地址

下载 
$ wget --no-check-certificate  https://files.pythonhosted.org/packages/45/ae/8a0ad77defb7cc903f09e551d88b443304a9bd6e6f124e75c0fbbf6de8f7/pip-18.1.tar.gz
解压 
$ tar -zxvf pip-18.1.tar.gz
$ cd pip-18.1/
$ python36 setup.py build
$ python36 setup.py install
安装gcc
$ yum -y install gcc
安装 python36-devel
$ yum -y  install python36-devel.x86_64
安装uwsgi
$ pip3 install uwsgi
安装supervisor
$ yum -y install supervisor

配置supervisor
$ vim /etc/supervisord.conf
------在这个最后面添加Program-----
[include]
files = supervisord.d/*.ini
>>开始添加 (本行忽略)
[program: 您的项目名称]
command=uwsgi --socket :8000 --chdir /项目地址/ -w 项目名称.wsgi
autostart=true
autorestart=true
安装nginx
$ yum -y install nginx

配置nginx
$ vim /etc/nginx/nginx.conf 
--------修要修改位置------
    server {
        listen       80 default_server; # 修改成您的端口
        listen       [::]:80 default_server; # 修改成您的端口
        server_name  您的ip地址; # 修改成您的地址
        root         /usr/share/nginx/html;
        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;
      location /static {
                alias /项目地址/static;
        }
        location / {
                include uwsgi_params;
                uwsgi_pass 127.0.0.1:8000;
        }
       
    }
-------结束---------
$ nginx -t 检查

启动

$ nginx
$ supervisord

相关文章

网友评论

      本文标题:Django 快速部署CentOS,Nginx,uWsgi,Su

      本文链接:https://www.haomeiwen.com/subject/vcahkqtx.html