gunicorn manage:app -k gevent -w 4
什麼是Gunicron:是一個unix上被普遍使用的高性能的Python WSGI UNIX HTTP Server。和大多數的web框架兼容,並具備實現簡單,輕量級,高性能等特色。html
gevent==1.3.6
greenlet==0.4.14
gunicorn==19.9.0
pymongo==3.7.0python
def __init__(self): config_name = os.getenv('FLASK_CONFIG') or 'default' base_config = config[config_name] # object self.client = MongoClient(host=base_config.MONGO_HOST, port=base_config.MONGO_PORT) db_name = base_config.MONGO_NAME self.db = self.client[db_name]
def __init__(self): config_name = os.getenv('FLASK_CONFIG') or 'default' base_config = config[config_name] # object self.client = MongoClient(host=base_config.MONGO_HOST, port=base_config.MONGO_PORT, maxIdleTimeMS=300000, connect=False) db_name = base_config.MONGO_NAME self.db = self.client[db_name]