gunicorn 是一款支持wsgi的web服务器, 支持gevent

首先安装setuptools.  wget https://bootstrap.pypa.io/ez_setup.py

$python ez_setup.py

$easy_install pip

$pip install gevent

$pip install gunicorn

$apt-get install libmysqld-dev

$pip install MySQL-python

安装完成后 既可以直接执行 gunicorn code:application   code是的你代码文件。。 application是wsgifunc 默认使用的是8000端口

如flask:

core.py

 from flask import Flask
app = Flask(__name__) @app.route('/')
def hello_world():
return 'Hello World!'

运行方法:  gunicorn core:app

浏览器访问localhost:8000

可用的参数:

gunicorn -b 127.0.0.1:8080 core:app  绑定端口

gunicorn -w 8 core:app  开启多进程。

gunicorn -k gevent core:app 使用gevent模式

完成后, 配合nginx Supervisor(进程管理工具)即可搭建出健壮的服务器。

使用gunicorn部署python web的更多相关文章

  1. supervisor+gunicorn部署python web项目

    有了Nginx,对于Tomcat没有必要详细了解. 有了supervisor,再也没有必要把一个程序设置成服务.驻留进程,supervisor真是一个相见恨晚的好工具. 在Tomcat中,所有的web ...

  2. nginx上部署python web

    nginx上部署python web http://uwsgi-docs.readthedocs.io/en/latest/tutorials/Django_and_nginx.html

  3. nginx+gunicorn/uwsgi+python web 的前世今生

    我们在部署 flask.django 等 python web 框架时,网上最多的教程就是 nginx+gunicorn/uwsgi 的部署方式,那为什么要这么部署呢,本文就来系统地解释这个问题. 必 ...

  4. nginx+uwsgi部署python web(web.py)

    1.nginx: nginx 是一个 http 服务器,与 apache.lighttpd.Microsoft IIS 等属于同类产品. 2.uWSGI: uWSGI 是一个快速的.纯C语言开发的.自 ...

  5. 使用uwsgi 部署python web服务

    uwsgi, wsgi协议的一个很好的实现,源码在这里:https://github.com/unbit/uwsgi c语言编写,有兴趣可以研究下. 上DEMO: wsgi_server.py def ...

  6. virtualenv 环境下 Nginx + Flask + Gunicorn+ Supervisor 搭建 Python Web

    在这篇文章里,我们将搭建一个简单的 Web 应用,在虚拟环境中基于 Flask 框架,用 Gunicorn 做 wsgi 容器,用 Supervisor 管理进程,然后使用 Python 探针来监测应 ...

  7. 全面解读python web 程序的9种部署方式

    转载自鲁塔弗的博客,本文地址http://lutaf.com/141.htm  python有很多web 开发框架,代码写完了,部署上线是个大事,通常来说,web应用一般是三层结构 web serve ...

  8. [原]Python Web部署方式总结

    不要让服务器裸奔 学过PHP的都了解,php的正式环境部署非常简单,改几个文件就OK,用FastCgi方式也是分分钟的事情.相比起来,Python在web应用上的部署就繁杂的多,主要是工具繁多,主流服 ...

  9. 如何使用Nginx和uWSGI或Gunicorn在Ubuntu上部署Flask Web应用

    你好!欢迎阅读我的博文,你可以跳转到我的个人博客网站,会有更好的排版效果和功能. 此外,本篇博文为本人Pushy原创,如需转载请注明出处:https://pushy.site/posts/151981 ...

随机推荐

  1. zz深度学习目标检测2014至201901综述

    论文学习-深度学习目标检测2014至201901综述-Deep Learning for Generic Object Detection A Survey  发表于 2019-02-14 |  更新 ...

  2. 2019-2020 ICPC Asia Hong Kong Regional Contest

    题解: https://files.cnblogs.com/files/clrs97/19HKEditorial-V1.zip Code:(Part) A. Axis of Symmetry #inc ...

  3. Debian 9 部分快捷键失效问题

    教程 具体修复过程: 安装gnome-screensaver包,重启恢复正常.

  4. TCP三次握手及四次断开,TCP有限状态机

    TCP 的连接建立 上图画出了 TCP 建立连接的过程.假定主机 A 是 TCP 客户端,B是服务端.最初两端的 TCP 进程都处于 CLOSED 状态.图中在主机下面的是 TCP进程所处的状态.A ...

  5. [LeetCode] 40. Combination Sum II 组合之和之二

    Given a collection of candidate numbers (candidates) and a target number (target), find all unique c ...

  6. [LeetCode] 34. Find First and Last Position of Element in Sorted Array 在有序数组中查找元素的第一个和最后一个位置

    Given an array of integers nums sorted in ascending order, find the starting and ending position of ...

  7. multiply two numbers using + opertor

    public class Solution { public static void main(String[] args) { , y = ; ; ; i <= y; i++) res = i ...

  8. twig输出转义

    twig输出转义--需求:传一个变量到 twig 中,需要插入几个空格,类似于下面这样:sprintf("%s%s -- %s", str_repeat(' ', $path_le ...

  9. 微信企业号JS SDK

    微信企业号JS SDK <?php define('CorpID', "wx82e2c31215d9a5a7"); define('CorpSecret', "&q ...

  10. 雪花算法(snowflake)的JAVA实现

    snowflake算法由twitter公司出品,原始版本是scala版,用于生成分布式ID,结构图: 算法描述: 最高位是符号位,始终为0,不可用. 41位的时间序列,精确到毫秒级,41位的长度可以使 ...