gunicorn

Cannot get gunicorn to use Python 3

丶灬走出姿态 提交于 2019-12-05 02:25:57
问题 I have Ubuntu+NGINX+Gunicorn with a virtual environment that works with Python 3 setup but my Flask app still runs as 2.7.6. I have methodically followed the instructions but I cannot find a resolution. Gunicorn config file [program:app-server] command = gunicorn app:app -b localhost:8000 directory = /home/www/app-server user = appuser Project directory structure app-server ----app.py ----venv (virtual environment) 回答1: Gunicorn is itself a Python application; the Gunicorn PPA only publishes

restrict access to the admin url by ip in django with nginx and gunicorn

≡放荡痞女 提交于 2019-12-05 02:01:31
问题 I am trying to restrict access to the admin section of my django app by using simple host-based access control in nginx. Unfortunately nginx does not seem to abide by the configuration request: this is my setting for this particular section in nginx: # gunicorn setup location / { proxy_pass http://127.0.0.1:8000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } location /admin/ { # restrict access to admin

How to serve static content with Nginx and Django Gunicorn when using Traefik

倖福魔咒の 提交于 2019-12-05 01:09:33
问题 I have a web application (Django based) that is utilising multiple containers: Web Application (Django + Gunicorn) Traefik (acting as the reverse proxy and SSL termination) Database which is used with the Web application Redis which is used with the Web application According to some of the documentation I have read, I should be serving my static content using something like NGINX. But I don't have any idea on how I would do that. Would I install NGINX on my Web Application container or as a

Log rotation with Gunicorn

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-05 00:48:46
I searched through the net but didn't get the concrete answer or example of "how to use log rotation with Gunicorn?" . It would be great if someone provide an example. Gunicorn's documentation says you can setup log rotation with logrotate (a linux command): Logs can be automatically rotated and compressed using logrotate. Doc link: http://docs.gunicorn.org/en/latest/install.html?highlight=logrotate#debian-gnu-linux So I guess Gunicorn provides itself no way to rotate log. Here is an example of my configuration file, placed in /etc/logrotate.d/my_app : /path/to/my/logs/gunicorn-access.log

Nginx configuration for static sites in root directory, Flask apps in subdirectories

江枫思渺然 提交于 2019-12-04 23:43:14
I'd like to have a static site in my root public_html directory, then Flask apps in their own subdirectories (e.g. public_html/foo). The static root directory functions as expected. I have spent hours editing the nginx configuration to get the Flask apps working, but always end up back in the same place, namely that the following code always returns 'Bad Config' when I migrate to mysite/foo. I want it to return 'Hello World!' If I alter the nginx configuration so that the server root is in public_html/foo, the Flask applications work as expected (i.e. mysite.com returns 'Hello World!'). In the

How to run gunicorn from a folder that is not the django project folder

守給你的承諾、 提交于 2019-12-04 21:27:38
问题 I git cloned a project in my home folder, let's call it /home/telessaude . So the project root is located at /home/telessaude/telessaude_branch_master If I am inside the Django project home folder ( /home/telessaude/telessaude_branch_master ) and issue a gunicorn comman such as gunicorn -w 2 -b 0.0.0.0:8000 telessaude.wsgi_dev:application --reload --timeout 900 gunicorn starts and works just fine. However ... if I try to run the same command on one directory above ( /home/telessaude ), I get

Gunicorn workers timeout no matter what

匆匆过客 提交于 2019-12-04 19:32:47
问题 I'm trying to run a simple flask app through gunicorn, but having my workers timeout no matter what I do. Whether there's activity against the app or not, workers will always timeout after whatever I set the timeout value to. What's causing them to timeout? Requests go through successfully when I make them, but workers still timeout. Here's what I'm running: gunicorn test_app.py -b 127.0.0.1:8000 --log-level=debug --log-file /tmp/log * Running on http://127.0.0.1:5000/ 127.0.0.1 - - [28/Aug

First name, last name and email address leak in forms randomly

北慕城南 提交于 2019-12-04 19:32:41
we have implemented django-allauth into our web app and we are facing random leaks. When a new user enters signup page, sometimes user sees first name, last name and email address of lastly logged user prefilled in signup form . This occurs really randomly, just sometimes. This also happens in profile edit form, which is just simple django form taking instance of user from self.request.user in CBV (FormView) like this: def get_form_kwargs(self): kwargs = super(ProfileView, self).get_form_kwargs() kwargs.update({ 'instance': self.request.user }) return kwargs We are using basic default setup of

Gunicorn will not bind to my application

*爱你&永不变心* 提交于 2019-12-04 18:08:49
问题 I have made a django web app using the default localhost, however I am trying to set it up on a server so that I can configure a postgre database and continue on without having to redo the database later on. I am hosting the site though a digital ocean ubuntu 14 droplet. When I created the droplet I selected that it already come preconfigured for django. It uses nginx and gunicorn to host the site. When I first created the instance of the server, a basic django app was configured to work on

Gunicorn worker timeout

偶尔善良 提交于 2019-12-04 17:29:33
问题 I have a Django application running in Gunicorn behind Nginx. Everything works fine, exect for one strange thing: I have a "download" view and a RESTful json API. When call the download view I use urllib2 to access the json API to get information. And excactly when I try to do this http get request to the json api, the request times out with an error HTTP Error 504: Gateway Time-out. When I run the code with ./manage.py runserver everything works fine. The http get request to the json api