gunicorn

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

帅比萌擦擦* 提交于 2019-12-03 20:06:32
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 section allow 192.168.0.1; deny all; } This does still block my ip 192.168.0.1. What am I doing wrong? Is

Connection refused while connecting to upstream when using nginx as reverse proxy

落花浮王杯 提交于 2019-12-03 18:14:25
The setup is as follows: I have a Gunicorn/Django app running on 0.0.0.0:8000 that is accessible via the browser. To serve static files I am running nginx as a reverse proxy. /etc/nginx/nginx.conf is configured to forward requests as follows: server { location /static/ { alias /data/www/; } # Proxying the connections location / { proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_redirect off; proxy_pass http://0.0.0.0:8000; } } and my docker-compose.yml file is as follows: version: '3.3' services: web: restart: always build: ./web expose: - "8000"

How to use Django logging with gunicorn

两盒软妹~` 提交于 2019-12-03 17:37:02
问题 I have a Django 1.6 site running with gunicorn, managed by supervisor. During tests and runserver I have logging on the console, but with gunicorn the statements don't show up anywhere (not even ERROR level logs). They should be in /var/log/supervisor/foo-stderr---supervisor-51QcIl.log but they're not. I have celery running on a different machine using supervisor and its debug statements show up fine in its supervisor error file. Edit: Running gunicorn in the foreground shows that none of my

How to configure Nginx with gunicorn and bokeh serve

放肆的年华 提交于 2019-12-03 17:29:20
I want to serve a flask app that uses embedded bokeh serve from a server on my local network. To illustrate I made an example using the bokeh serve example and a docker image to replicate the server. The docker image runs Nginx and Gunicorn. I think there is a problem with my nginx configuration routing the requests to the /bkapp uri. I have detailed the problem and provided all source code in the following git repo I have started a discussion on bokeh google group Single Container In order to reduce the complexity of running nginx in its own container I built this image that runs nginx in

Cannot get gunicorn to use Python 3

ε祈祈猫儿з 提交于 2019-12-03 16:41:43
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) Gunicorn is itself a Python application; the Gunicorn PPA only publishes Python 2 versions. You'd install Gunicorn into Python 3 instead (using pip , preferably into your virtualenv

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

ⅰ亾dé卋堺 提交于 2019-12-03 14:32:29
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 the following error: telessaude@ubuntu:~$ gunicorn -w 2 -b 0.0.0.0:8000 telessaude.wsgi_dev:application

Bad request 400: nginx / gunicorn

此生再无相见时 提交于 2019-12-03 14:29:42
问题 I have followed this tutorial: http://blog.wercker.com/2013/11/25/django-16-part3.html and I am just trying to make it work locally with Vagrant for now. I am not trying to use Wercker. After everything is installed, I try to access the website but I get a Bad Request (400) error every time. I do not know if that is due to a problem in nginx or in gunicorn. They both have a log entry so at least I know that the request goes all the way through gunicorn and is not stopped at the nginx level.

Supervisor not working with Gunicorn + Flask

最后都变了- 提交于 2019-12-03 14:22:33
I am trying to run Gunicorn from Supervisor in an Ubuntu 12.04 system. Gunicorn runs a Flask app (simple REST web service tested with Flask's embedded server). I have installed Gunicorn by clonning GIT repo, trying to avoid 'apt-get install' because it runs Gunicorn server when installs it. I do not want it running, it will be run by Supervisor only. So after install it, if I try: cd /usr/local/bin gunicorn my_app:app -c /path/to/gu_config_file Gunicorn works. Then I kill it. Note config file without extension, because with '.py' extension does not work for me. So I edit Supervisor's config

Gunicorn will not bind to my application

瘦欲@ 提交于 2019-12-03 12:15:39
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 the given IP. And it did. I tried cloning my project into the same directory as that project assuming it

Gunicorn not reloading a Django application

谁都会走 提交于 2019-12-03 11:50:57
问题 I'm getting inconsistent code-reloading behavior, with a Django 1.3 application and gunicorn 0.12.1, running inside a virtualenv. Gunicorn does not reload my application properly, even with a restart of the specific gunicorn process PID. When I run a basic runserver (through Django, via the manage.py command) this is not an issue. When I remove and recreate my virtualenv, gunicorn runs as expected with the new code. Is there a Python cache or something? I also tried to remove all *.pyc files.