美文网首页
flask 部署 (Nginx and Gunicorn )

flask 部署 (Nginx and Gunicorn )

作者: lessjianshu | 来源:发表于2019-03-18 17:34 被阅读0次

    尚未完结。。。

    sudo adduser XXX sudo
    sudo ufw allow 5000
    sudo ufw enable
    

    创建环境

    mkdir Flask_Blog
    cd Flask_Blog/
     ls
    cd ..
    sudo apt install python3-pip
    sduo apt install python3-venv
    sudo  apt install python3-venv
    python3 -m venv Flask_Blog/venv
    cd Flask_Blog/
    ls
    source venv/bin/activate
    pip install flask
    

    nginx

    sudo apt install nginx
    sudo rm /etc/nginx/sites-enabled/default
    sudo nano /etc/nginx/sites-enabled/flaskblog
    

    nginx: /etc/nginx/sites-enabled/flaskblog:

    server {
        listen 80;
        server_name YOUR_IP_OR_DOMAIN;
    
        location /static {
            alias /home/YOUR_USER/YOUR_PROJECT/flaskblog/static;
        }
    
        location / {
            proxy_pass http://localhost:8000;
            include /etc/nginx/proxy_params;
            proxy_redirect off;
        }
    }
    

    gunicorn

    ···

    相关文章

      网友评论

          本文标题:flask 部署 (Nginx and Gunicorn )

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