uwsgi

X-Forwarded-Proto and Flask

瘦欲@ 提交于 2019-12-18 03:52:20
问题 I have precisely the same problem described in this SO question and answer. The answer to that question is a nice work around but I don't understand the fundamental problem. Terminating SSL at the load balancer and using HTTP between the load balancer and web/app servers is very common. What piece of the stack is not respecting the X-Forwarded-Proto? Is it werkzeug? Flask? uwsgi? In my case I'm using an AWS ELB (which sets X-Forwarded-Proto) => Nginx (which forwards along X-Forwarded-Proto to

Permission Denied when writing log file

谁说我不能喝 提交于 2019-12-18 02:20:28
问题 I'm using ubuntu 13.04. I'm running uwsgi using sudo service uwsgi start I've configured log file in django as /home/shwetanka/logs/mysite/mysite.log But I'm getting this error - ValueError: Unable to configure handler 'file': [Errno 13] Permission denied: '/home/shwetanka/logs/mysite/mysite.log' How do I fix it? This should not happen when I run uwsgi as sudo. 回答1: You need to fix permissions with the chmod command, like this: chmod 775 /home/shwetanka/logs/mysite/mysite.log . Take a look at

Django +uwsgi+python3+nginx + mysql 部署

倾然丶 夕夏残阳落幕 提交于 2019-12-18 00:13:28
环境: 服务器ip:192.168.0.110 centos服务器 6.4 + mysql 5.6 + django1.11 +nginx 1.13.7 + uwsgi 2.0.18 uwsgi介绍 uWSGI是一个Web服务器,它实现了WSGI协议、uwsgi、http等协议。Nginx中HttpUwsgiModule的作用是与uWSGI服务器进行交换。 要注意 WSGI / uwsgi / uWSGI 这三个概念的区分。 WSGI是一种Web服务器网关接口。它是一个Web服务器(如nginx,uWSGI等服务器)与web应用(如用Flask框架写的程序)通信的一种规范。 uwsgi是一种线路协议而不是通信协议,在此常用于在uWSGI服务器与其他网络服务器的数据通信。 而uWSGI是实现了uwsgi和WSGI两种协议的Web服务器。 uwsgi协议是一个uWSGI服务器自有的协议,它用于定义传输信息的类型(type of information),每一个uwsgi packet前4byte为传输信息类型描述,它与WSGI相比是两样东西。 uWSGI的主要特点如下 超快的性能 低内存占用 多app管理 详尽的日志功能 高度可定制(内存大小限制,服务一定次数后重启等) nginx+uwsgi 工作原理:   nginx负责建立一个本地的工作环境,就是本地服务器,类似于pycharm的

How to set up autoreload with Flask+uWSGI?

ぐ巨炮叔叔 提交于 2019-12-17 23:20:36
问题 I am looking for something like uWSGI + django autoreload mode for Flask. 回答1: You could try using supervisord as a manager for your Uwsgi app. It also has a watch function that auto-reloads a process when a file or folder has been "touched"/modified. You will find a nice tutorial here: Flask+NginX+Uwsgi+Supervisord 回答2: I am running uwsgi version 1.9.5 and the option uwsgi --py-autoreload 1 works great 回答3: If you're configuring uwsgi with command arguments, pass --py-autoreload=1 : uwsgi -

Non-blocking concurrent wsgi server

核能气质少年 提交于 2019-12-17 19:52:06
问题 I am trying to be able to respond incoming web requests simultaneously, while processing of a request includes quite long IO call. I'm going to use gevent, as it's supposed to be "non-blocking" The problem I found is that requests are processed sequentially even though I have a lot of gevent threads. For some reason requests get served by single green thread. I have nginx (with default config which isn't relevant here I think), also I have uwsgi and simple wsgi app that emulates IO-blocking

Nginx error: (13: Permission denied) while connecting to upstream

为君一笑 提交于 2019-12-17 10:33:55
问题 I am getting this error in my nginx-error.log file: 2014/02/17 03:42:20 [crit] 5455#0: *1 connect() to unix:/tmp/uwsgi.sock failed (13: Permission denied) while connecting to upstream, client: xx.xx.x.xxx, server: localhost, request: "GET /users HTTP/1.1", upstream: "uwsgi://unix:/tmp/uwsgi.sock:", host: "EC2.amazonaws.com" The browser also shows a 502 Bad Gateway Error. The output of a curl is the same, Bad Gateway html I've tried to fix it by changing permissions for /tmp/uwsgi.sock to 777.

Flask and uWSGI - unable to load app 0 (mountpoint='') (callable not found or import error)

家住魔仙堡 提交于 2019-12-17 08:37:32
问题 I get the below error when I try and start Flask using uWSGI. Here is how I start: > # cd .. > root@localhost:# uwsgi --socket 127.0.0.1:6000 --file /path/to/folder/run.py --callable app - -processes 2 Here is my directory structure: -/path/to/folder/run.py -|app -|__init__.py -|views.py -|templates -|static Contents of /path/to/folder/run.py if __name__ == '__main__': from app import app #app.run(debug = True) app.run() Contents of /path/to/folder/app/__init__.py import os from flask import

Flask and uWSGI - unable to load app 0 (mountpoint='') (callable not found or import error)

与世无争的帅哥 提交于 2019-12-17 08:37:32
问题 I get the below error when I try and start Flask using uWSGI. Here is how I start: > # cd .. > root@localhost:# uwsgi --socket 127.0.0.1:6000 --file /path/to/folder/run.py --callable app - -processes 2 Here is my directory structure: -/path/to/folder/run.py -|app -|__init__.py -|views.py -|templates -|static Contents of /path/to/folder/run.py if __name__ == '__main__': from app import app #app.run(debug = True) app.run() Contents of /path/to/folder/app/__init__.py import os from flask import

Nginx 499 error codes

两盒软妹~` 提交于 2019-12-17 04:48:09
问题 I am getting a lot of 499 nginx error codes. I see that this is a client side issue. It is not a problem with Nginx or my uWSGI stack. I note the correlation in uWSGI logs when a get a 499. address space usage: 383692800 bytes/365MB} {rss usage: 167038976 bytes/159MB} [pid: 16614|app: 0|req: 74184/222373] 74.125.191.16 () {36 vars in 481 bytes} [Fri Oct 19 10:07:07 2012] POST /bidder/ => generated 0 bytes in 8 msecs (HTTP/1.1 200) 1 headers in 59 bytes (1 switches on core 1760) SIGPIPE:

django nginx uwsgi deploying fail

删除回忆录丶 提交于 2019-12-14 03:11:39
问题 I am trying to deploy a simple Django project, but fail all the time. I am following the instruction here. When I use python manage.py runserver 0.0.0.0:8000 I can see that my site is running: In the virtualenv I've installed uWSGI: pip install uwsgi and wrote the test.py : # test.py def application(env, start_response): start_response('200 OK', [('Content-Type','text/html')]) return [b"Hello World"] # python3 #return ["Hello World"] # python2 When running uwsgi --http :8000 --wsgi-file test