zoukankan      html  css  js  c++  java
  • 部署到服务上

    1.在主目录中添加一个wsgi.py文件

    # -*- coding:utf-8 -*-
    import sys
    from os.path import abspath
    from os.path import dirname
    
    sys.path.insert(0, abspath(dirname(__file__)))
    
    import app
    
    # 必须有一个叫做application的变量
    # gunicorn 就要这个变量
    # 这个变量的值必须是Flask的实力
    application = app.app
    
    # 这是把代码部署到 apache gunicorn nginx 后面的套路
    

    2.安装gunicorn    pip3 install gunicorn (green unicorn) 独角兽

    3. gunicorn wsgi --bind 0.0.0.0:2000

    4.安装supervisor :    pip install supervisor 

    5. 把/usr/local/lib/python2.7/dist-packages/supervisor移动到/etc/supervisor

    6.生成配置文件 echo_supervisord_conf > /etc/supervisor/supervisord.conf

    7.创建/etc/supervisor/conf.d目录,用于存放进程管理文件

    8.修改/etc/supervisor/supervisord.conf中的最后的[include]参数, 将/etc/supervisor/conf.d目录添加到include中

    9.在conf.d下创建一todo.ini的文件

      1 [progarm:todo]
      2 command=gunicorn --bind 0.0.0.0:2000 --pid/tem/todo.pid
      3 directory=/root/home/python/Desktop/day13
      4 autosatrt=ture
    ~                    
    

    10. supervisorctl start todo

  • 相关阅读:
    Solr部署准备
    linux 安装SVN
    构建高性能web站点--读书大纲
    webapi请求
    搭建git服务器
    git常用知识整理
    Ruby on Rail 开发入门
    Ruby on rail 开发准备
    PHP模拟请求雅虎竞标商品加价
    JAVA httpURLConnection curl
  • 原文地址:https://www.cnblogs.com/cuzz/p/8067002.html
Copyright © 2011-2022 走看看