uwsgi

Nginx timeouts when uWSGI takes long to process request

社会主义新天地 提交于 2019-12-02 17:27:25
I have Nginx + uWSGI for Python Django app. I have the following in my nginx.conf : location / { include uwsgi_params; uwsgi_pass 127.0.0.1:9001; uwsgi_read_timeout 1800; uwsgi_send_timeout 300; client_header_timeout 300; proxy_read_timeout 300; index index.html index.htm; } but for long running requests on uWSGI which takes about 1 minute to complete I get a timeout error in Nginx error log as below: 2013/04/22 12:35:56 [error] 2709#0: *1 upstream timed out (110: Connection timed out) while reading response header from upstream, client: xx.xx.xx.xx, server: , request: "GET /entity/datasenders

Django memory leak: possible causes?

冷暖自知 提交于 2019-12-02 17:17:54
I've a Django application that every so often is getting into memory leak. I am not using large data that could overload the memory, in fact the application 'eats' memory incrementally (in a week the memory goes from ~ 70 MB to 4GB), that is why I suspect the garbage collector is missing something, I am not sure though. Also, it seems as this increment is not dependant of the number of requests. Obvious things like DEBUG=True , leaving open files, etc... no apply here. I'm using uWSGI 2.0.3 (+ nginx) and Django 1.4.5 I could set up wsgi so that restart the server when the memory exceeds

django + uwsgi 部署上线

◇◆丶佛笑我妖孽 提交于 2019-12-02 14:45:55
django + uwsgi 部署上线 开发阶段使用运行命令 1 # 事实上runserver 就是django 自带的一个服务器 因为收发请求性能较差仅在开发阶段使用, ​项目部署我们一般使用uwsgi 服务器来处理动态请求 2 python manage.py runserver 啥是uwsgi? 一个轻量级的python服务器 遵从 wsgi 协议,简单好用就是了 流程 安装uwsgi 1 pip install uwsgi 2 # 无法成功下载试试更新pip 或者换国内源 更改项目配置 1 #线上模式 2 ​ 3 # settings 中 4 ​ 5 DEBUG = FALSE 6 ​ 7 ALLOWSE_HOST=['*'] 8 ​ 创建 uwsgi启动文件 ​ 1 ------------uwsgi.ini------------ 2 [uwsgi] 3 # 使用nginx 时 4 socket = 127.0.0.1:8000 5 # 直接使用uwsgi 6 http= 127.0.0.1:8000 7 # 项目目录 8 chdir=/home/python/Desktop/ai-web 9 # 项目中uwsgi.py 位置相对于 项目目录 10 wsgi_fire=ai-web/aiweb/wsgi,py 11 processes=4 # 进程数 12

WSGI vs uWSGi with Nginx [closed]

早过忘川 提交于 2019-12-02 13:53:08
Could anyone please explain pros/cons when using WSGI VS uWSGI with Nginx. Currently i am building up a production server for the Django website which i have prepared but unable to decide whether should i go with WSGI or uWSGI. Could you please explain in detail what differentiates each configuration? Which configuration should scale the best? Thanks in advance Derek Litz Ok, guys this confusion is because of lack of detail from several sources, and the naming of these protocols, and what WSGI actually is. Summary: WSGI and uwsgi both ARE protocols, not servers. It is used to communicate with

Bad Django / uwsgi performance

徘徊边缘 提交于 2019-12-02 13:47:27
I am running a django app with nginx & uwsgi. Here's how i run uwsgi: sudo uwsgi -b 25000 --chdir=/www/python/apps/pyapp --module=wsgi:application --env DJANGO_SETTINGS_MODULE=settings --socket=/tmp/pyapp.socket --cheaper=8 --processes=16 --harakiri=10 --max-requests=5000 --vacuum --master --pidfile=/tmp/pyapp-master.pid --uid=220 --gid=499 & nginx configurations: server { listen 80; server_name test.com root /www/python/apps/pyapp/; access_log /var/log/nginx/test.com.access.log; error_log /var/log/nginx/test.com.error.log; # https://docs.djangoproject.com/en/dev/howto/static-files/#serving

Can I use the uwsgi protocol to call http?

只愿长相守 提交于 2019-12-02 11:38:19
问题 Here's a data flow: http <--> nginx <--> uWSGI <--> python webapp I guess there's http2uwsgi transfer in nginx, and uwsgi2http in uWSGI. What if I want to directly call uWSGI to test an API in a webapp? actually i'm using pyramid. just config [uwsgi] in .ini and run uWSGI. but i want to test if uWSGI hold webapp function normally, the uWSGI socket is not directly reachable by http. 回答1: Try using uwsgi_curl $ pip install uwsgi-tools $ uwsgi_curl 10.0.0.1:3030 /path or if you need to do some

uWSGI+Nginx+Django安装和配置

那年仲夏 提交于 2019-12-02 10:18:08
WSGI是为python语言定义的通用网关接口,它承担python web框架(django、flask、web.py等)和web服务器(nginx、apache、lighttpd等)之间的中间层。 浏览器 chrome、firefox、ie等 | web服务器 nginx、apache等 | 网关接口 CGI 、Fast CGI 、WSGI等 | Python(程序、Web框架) Django、Flask、Tornado等 python中自带的wsgiref就是一种wsgi接口的标准实现,但是,由于100%使用python实现等原因,导致wsgiref实在过于缓慢,只能用于测试和学习。生产环境中我们需要使用性能更高的服务器,目前常用的wsgi服务器有:uWSGI、Gunicorn、twisted.web。 1 uWSGI的安装 uWSGI是用C语言写的高性能WSGI服务器,安装uWSGI前我们需要安装Python和C编译器(GCC)。推荐使用python包管理器pip安装uWSGI。 #安装最新稳定版 pip install uWSGI #也可以安装长期支持版(LTS版本) #pip install http://projects.unbit.it/downloads/uwsgi-lts.tar.gz 在ubuntu下可以使用apt-get来安装 apt-get install

intercepting upstream error with nginx

删除回忆录丶 提交于 2019-12-02 09:23:44
问题 My app runs with nginx and uwsgi (python). My aim is to drop a connection (as explained here) e.g. when the python app decides to do so. Is there a nginx parameter to "intercept" upstream errors similar to proxy_intercept_errors ? According to this answer, My nginx config: location / { uwsgi_pass myapp; include uwsgi_params; uwsgi_buffering on; uwsgi_buffer_size 8k; uwsgi_connect_timeout 800; uwsgi_read_timeout 800; uwsgi_send_timeout 800; proxy_intercept_errors on; error_page 420 =444 @foo;

uWSGI, ImportError: No module named site on Ubuntu

夙愿已清 提交于 2019-12-02 08:42:23
I'm trying to follow the tutorial at http://uwsgi-docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html . I've gotten everything working down tohttp://uwsgi-docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html#install-uwsgi-system-wide. I am working with an ubuntu 14.4 instance on amazon EC2: Without going into my virtualenv , I ran: sudo pip install uwsgi This led to ############## end of uWSGI configuration ############# total build time: 24 seconds *** uWSGI is ready, launch it with /usr/local/bin/uwsgi *** Successfully installed uwsgi Cleaning up... Then I ran: ubuntu@ip

Django(十六):项目部署

梦想与她 提交于 2019-12-02 08:41:21
文章目录 一. 安装django环境 1. 导出django的开发环境 2. 将包目录上传服务器,并进行安装 二. 上传django项目 三. 安装uwsgi 1. 安装配置uwsgi 四. 安装NGINX 五. 修改NGINX的配置文件 一. 安装django环境 1. 导出django的开发环境 激活虚拟环境 pip freeze > package . txt 2. 将包目录上传服务器,并进行安装 将package . txt,放在 / opt目录下 安装 pip3 install - r package . txt 安装过程中出现超时错误:更换下载源 pip3 install - r package . txt - i 源地址 二. 上传django项目 1.将django项目放在 /opt目录下 2.项目测试 systemctl stop firewalld 修改 sttings⽂件,修改 ALLOWED_HOSTS = [ '*' ] 允许所有的主机访问 启动项目 python3 manage . py runserver 0.0 .0 .0 : 8000 如果出现项目报错,可能是配置中对于版本过高的问题,去修改即可 三. 安装uwsgi 上面我们已经完成了python+Django环境的部署,接下来我们需要了解python 的uwsgi框架: Python