【python Flask】用uwsgi 启动flask 服务方式

Python 安装 uWSGI

pip install uwsgi

用uwsgi 启动flask 服务方式:
在flask项目目录下新建文件 uwsgi.ini 文件,写入如下内容:

[uwsgi]
master = true
http=:5000
chdir = /home/urun/web/cluster_manager
wsgi-file=/home/urun/web/cluster_manager/run.py
callable=app
processes=4
threads=2
buffer-size = 65536
vacuum=true
pidfile =/home/urun/web/cluster_manager/uwsgi.pid
-- 启动 uwsgi
uwsgi uwsgi.ini

-- 停止 uwsgi
pkill -f -9 uwsgi

参考链接:http://www.runoob.com/python3/python-uwsgi.html

发布了651 篇原创文章 · 获赞 791 · 访问量 187万+
展开阅读全文

uWSGI uwsgi uwsgi.ini 启动报错怎么办

08-11

``` [root@VM_0_15_centos ~]# cd /www [root@VM_0_15_centos www]# uwsgi uwsgi.ini [uWSGI] getting INI configuration from uwsgi.ini *** Starting uWSGI 2.0.18 (64bit) on [Sun Aug 11 20:18:39 2019] *** compiled with version: 4.8.5 20150623 (Red Hat 4.8.5-36) on 11 August 2019 11:49:00 os: Linux-3.10.0-862.el7.x86_64 #1 SMP Fri Apr 20 16:44:24 UTC 2018 nodename: VM_0_15_centos machine: x86_64 clock source: unix pcre jit disabled detected number of CPU cores: 1 current working directory: /www detected binary path: /usr/local/bin/uwsgi setgid() to 1000 setuid() to 1000 chdir() to /www *** WARNING: you are running uWSGI without its master process manager *** your processes number limit is 3882 your memory page size is 4096 bytes detected max file descriptor number: 100001 lock engine: pthread robust mutexes thunder lock: disabled (you can enable it with --thunder-lock) uwsgi socket 0 bound to TCP address 127.0.0.1:9000 fd 3 Python version: 3.7.0 (default, Aug 11 2019, 19:03:29) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] Python main interpreter initialized at 0x1ef25f0 python threads support enabled your server socket listen backlog is limited to 100 connections your mercy for graceful operations on workers is 60 seconds mapped 333504 bytes (325 KB) for 8 cores *** Operational MODE: preforking+threaded *** added /www/ to pythonpath. ModuleNotFoundError: No module named 'www' unable to load app 0 (mountpoint='') (callable not found or import error) WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0x1ef25f0 pid: 26222 (default app) *** uWSGI is running in multiple interpreter mode *** spawned uWSGI worker 1 (pid: 26222, cores: 2) spawned uWSGI worker 2 (pid: 26223, cores: 2) spawned uWSGI worker 3 (pid: 26224, cores: 2) spawned uWSGI worker 4 (pid: 26225, cores: 2) ``` **启动报错已经解决了一个,但是其他的实在没办法 大神,怎么解决 之前没这个问题,出现之后不管怎么重新装系统都解决不了** 以下是配置文件 ``` [uwsgi] uid = www gid = www socket = 127.0.0.1:9000 chdir = /www module=www.wsgi wsgi-file = /www/hello.py callable = app processes = 4 threads = 2 pythonpath = /www ``` 十分感激,实在是找不到方法了,网络上的都找了 问答

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 编程工作室 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览