django nginx uwsgi ubuntu server deploying fail - django

I am trying to set up my little Django project (Django 1.8) with nginx and uwsgi, but it just fails when running:
uwsgi --socket :8001 --wsgi-file test.py
which follows documentation.
I do not know why? I just step by step but when I run above command and check my serverip:8000 it shows nothing. However when I run:
uwsgi --http :8000 --wsgi-file test.py
it works and shows Hello World web site. Running command:
uwsgi --http :8000 --module myproject.wsgi
it works and shows myproject web site.
But when it comes to
uwsgi --socket :8001 --wsgi-file test.py
it just fails..
here is my nginx site config:
upstream django {
#server unix:///home/ubuntu/path/myproject/myproject.sock; # for a file socket
server 127.0.0.1:8001; # for a web port socket (we'll use this first)
}
# configuration of the server
server {
# the port your site will be served on
listen 8000;
# the domain name it will serve for
server_name 123.123.123.123; # substitute your machine's IP address or FQDN
charset utf-8;
# max upload size
client_max_body_size 75M; # adjust to taste
# Django media
location /media {
alias /home/ubuntu/path/myproject/media; # your Django project's media files - amend as required
}
location /static {
alias /home/ubuntu/path/myproject/myapp/static; # your Django project's static files - amend as required
}
# Finally, send all non-media requests to the Django server.
location / {
uwsgi_pass django;
include /home/ubuntu/path/myproject/uwsgi_params; # the uwsgi_params file you installed
}
}
the uwsgi_params
uwsgi_param QUERY_STRING $query_string;
uwsgi_param REQUEST_METHOD $request_method;
uwsgi_param CONTENT_TYPE $content_type;
uwsgi_param CONTENT_LENGTH $content_length;
uwsgi_param REQUEST_URI $request_uri;
uwsgi_param PATH_INFO $document_uri;
uwsgi_param DOCUMENT_ROOT $document_root;
uwsgi_param SERVER_PROTOCOL $server_protocol;
uwsgi_param REQUEST_SCHEME $scheme;
uwsgi_param HTTPS $https if_not_empty;
uwsgi_param REMOTE_ADDR $remote_addr;
uwsgi_param REMOTE_PORT $remote_port;
uwsgi_param SERVER_PORT $server_port;
uwsgi_param SERVER_NAME $server_name;
Log from (not working) uWSGI command:
!!! no internal routing support, rebuild with pcre support !!!
*** WARNING: you are running uWSGI without its master process manager ***
your processes number limit is 7862
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to TCP address :8001 fd 3
Python version: 2.7.6 (default, Jun 22 2015, 18:01:27) [GCC 4.8.2]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x1ad5ec0
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 72768 bytes (71 KB) for 1 cores
*** Operational MODE: single process ***
WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0x1ad5ec0 pid: 13959 (default app)
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI worker 1 (and the only) (pid: 13959, cores: 1)

Related

How to configure an NGINX & UWSGI in Django

I am deploying my Django app on VPS and I would like to use NGINX & UWSGI
I have followed this tutorial https://www.youtube.com/watch?v=ZpR1W-NWnp4 in order to configure my NGINX server.
Below is my NGINX configuration file named my_nginx.conf:
# the upstream component nginx needs to connect to
upstream django {
server unix:///root/PIDC/ProjetAgricole/uwsgi_nginx.sock; # for a file socket
# server 127.0.0.1:8001; # for a web port socket (we'll use this first)
}
# configuration of the server
server {
# the port your site will be served on
listen 80;
# the domain name it will serve for
server_name 173.249.8.237; # substitute your machine's IP address or FQDN
charset utf-8;
# max upload size
client_max_body_size 75M; # adjust to taste
# Django media
location /media {
alias /root/PIDC/ProjetAgricole/media; # your Django project's media files - amend as required
}
location /static {
alias /root/PIDC/ProjetAgricole/staticfiles; # your Django project's static files - amend as required
}
# Finally, send all non-media requests to the Django server.
location / {
uwsgi_pass django;
include /root/PIDC/ProjetAgricole/uwsgi_params; # the uwsgi_params file you installed
}
}
I just changed the paths only in this file.
When I run this command, I am getting this output that seems to be fine.
(venv) root#vmi851374:~/PIDC/ProjetAgricole# uwsgi --socket ProjetAgricole.sock --module ProjetAgricole.wsgi --chmod-socket=666
*** Starting uWSGI 2.0.20 (64bit) on [Fri Apr 22 22:36:02 2022] ***
compiled with version: 9.4.0 on 17 April 2022 18:54:03
os: Linux-5.4.0-105-generic #119-Ubuntu SMP Mon Mar 7 18:49:24 UTC 2022
nodename: vmi851374.contaboserver.net
machine: x86_64
clock source: unix
detected number of CPU cores: 4
current working directory: /root/PIDC/ProjetAgricole
detected binary path: /root/my_project/venv/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
*** WARNING: you are running uWSGI without its master process manager ***
your processes number limit is 31601
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to UNIX address ProjetAgricole.sock fd 3
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
Python version: 3.8.10 (default, Mar 15 2022, 12:22:08) [GCC 9.4.0]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x561dba821d90
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 72904 bytes (71 KB) for 1 cores
*** Operational MODE: single process ***
WSGI app 0 (mountpoint='') ready in 1 seconds on interpreter 0x561dba821d90 pid: 294717 (default app)
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI worker 1 (and the only) (pid: 294717, cores: 1)
However, when I run the application in my browser, I ma getting the 502 Bad Gateway.
The content of the uwsgi_params file is:
uwsgi_param QUERY_STRING $query_string;
uwsgi_param REQUEST_METHOD $request_method;
uwsgi_param CONTENT_TYPE $content_type;
uwsgi_param CONTENT_LENGTH $content_length;
uwsgi_param REQUEST_URI $request_uri;
uwsgi_param PATH_INFO $document_uri;
uwsgi_param DOCUMENT_ROOT $document_root;
uwsgi_param SERVER_PROTOCOL $server_protocol;
uwsgi_param REMOTE_ADDR $remote_addr;
uwsgi_param REMOTE_PORT $remote_port;
uwsgi_param SERVER_ADDR $server_addr;
uwsgi_param SERVER_PORT $server_port;
uwsgi_param SERVER_NAME $server_name;
I am getting confused about this error.
Please assist me.

Why I am getting the NGINX welcome page instead of my Django application

I have deployed my Django Application on a VPS server. I have configured NGINX and uWSGI server.
Here is my Nginx configuration
# the upstream component nginx needs to connect to
upstream django {
server unix:///root/PIDC/ProjetAgricole/ProjetAgricole.sock; # for a file socket
# server 127.0.0.1:8001; # for a web port socket (we'll use this first)
}
# configuration of the server
server {
# the port your site will be served on
listen 8000;
# the domain name it will serve for
server_name my_public_IP_address; # substitute your machine's IP address or FQDN
charset utf-8;
# max upload size
client_max_body_size 75M; # adjust to taste
# Django media
location /media {
alias /root/PIDC/ProjetAgricole/media;
}
location /static {
alias /root/PIDC/ProjetAgricole/static;
}
# Finally, send all non-media requests to the Django server.
location / {
uwsgi_pass django;
include /root/PIDC/ProjetAgricole/uwsgi_params;
}
}
Here is my mysite_uwsgi.ini file
# mysite_uwsgi.ini file
[uwsgi]
# Django-related settings
# the base directory (full path)
chdir = /root/PIDC/ProjetAgricole
# Django's wsgi file
module = project.wsgi
# the virtualenv (full path)
home = /root/my_project/venv
# process-related settings
# master
master = true
# maximum number of worker processes
processes = 10
# the socket (use the full path to be safe
socket = /root/PIDC/ProjetAgricole/ProjetAgricole.sock
# ... with appropriate permissions - may be needed
# chmod-socket = 664
# clear environment on exit
vacuum = true
When I am running the Django application with uwsgi and nginx by using this command:
uwsgi --socket ProjetAgricole.sock --module ProjetAgricole/ProjetAgricole.wsgi --chmod-socket=664
I am getting this output as a result of the command:
(venv) root#vmi851374:~/PIDC/ProjetAgricole# uwsgi --socket ProjetAgricole.sock --module ProjetAgricole/ProjetAgricole.wsgi --chmod-socket=664
*** Starting uWSGI 2.0.20 (64bit) on [Sun Apr 24 18:57:17 2022] ***
compiled with version: 9.4.0 on 17 April 2022 18:54:03
os: Linux-5.4.0-105-generic #119-Ubuntu SMP Mon Mar 7 18:49:24 UTC 2022
nodename: vmi851374.contaboserver.net
machine: x86_64
clock source: unix
detected number of CPU cores: 4
current working directory: /root/PIDC/ProjetAgricole
detected binary path: /root/my_project/venv/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
*** WARNING: you are running uWSGI without its master process manager ***
your processes number limit is 31601
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to UNIX address ProjetAgricole.sock fd 3
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
Python version: 3.8.10 (default, Mar 15 2022, 12:22:08) [GCC 9.4.0]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x55d5d758ada0
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 72904 bytes (71 KB) for 1 cores
*** Operational MODE: single process ***
ModuleNotFoundError: No module named 'ProjetAgricole/ProjetAgricole'
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. going in full dynamic mode ***
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI worker 1 (and the only) (pid: 327968, cores: 1)
The content of /root/PIDC/ProjetAgricole/uwsgi_params is:
uwsgi_param QUERY_STRING $query_string;
uwsgi_param REQUEST_METHOD $request_method;
uwsgi_param CONTENT_TYPE $content_type;
uwsgi_param CONTENT_LENGTH $content_length;
uwsgi_param REQUEST_URI $request_uri;
uwsgi_param PATH_INFO $document_uri;
uwsgi_param DOCUMENT_ROOT $document_root;
uwsgi_param SERVER_PROTOCOL $server_protocol;
uwsgi_param REMOTE_ADDR $remote_addr;
uwsgi_param REMOTE_PORT $remote_port;
uwsgi_param SERVER_ADDR $server_addr;
uwsgi_param SERVER_PORT $server_port;
uwsgi_param SERVER_NAME $server_name;
When I run my application via the web browser it is displaying the NGINX welcome page instead of my project home page which is supposed to appear.
Are there any mistakes in the configurations files?
Please assist

Django uwsgi + nginx repeated processes

I have my application deployed in django web framework running with wsgi + nginx on the production env. Recently, i found some weird behavior from wsgi where it starts executing/repeating the function if the original request does not complete within 4-5 minutes. I increased the read_timeout and write_timeout under nginx config file, however, this issue is still there!! any expert on nginx uwsgi deployment? snippet from nginx.conf file:-
location /netadc/ {
uwsgi_pass django;
include /apps/netadc/netadc/uwsgi_params;# the uwsgi_params file you installed
uwsgi_read_timeout 1800;
uwsgi_send_timeout 1800;
proxy_read_timeout 1800;
}
Basically this feature/script does lot of pre-validations, creates a snapshot of the n/w devices, pushes configs to around 30-40 devices and does post validations. so it takes 2-3 mins minimum to execute. sometimes when it takes more than 5 mins., it restarts the wsgi process, but not sure why... since i already increased the timeout to 30 mins as shown above.
uwsgi_params :-
uwsgi_param QUERY_STRING $query_string;
uwsgi_param REQUEST_METHOD $request_method;
uwsgi_param CONTENT_TYPE $content_type;
uwsgi_param CONTENT_LENGTH $content_length;
uwsgi_param REQUEST_URI $request_uri;
uwsgi_param PATH_INFO $document_uri;
uwsgi_param DOCUMENT_ROOT $document_root;
uwsgi_param SERVER_PROTOCOL $server_protocol;
uwsgi_param HTTPS $https if_not_empty;
uwsgi_param REMOTE_ADDR $remote_addr;
uwsgi_param REMOTE_PORT $remote_port;
uwsgi_param SERVER_PORT $server_port;
uwsgi_param SERVER_NAME $server_name;
There is no error in nginx error file or access log file that I can locate.
nginx.conf file:-
upstream django {
server unix:///apps/netadc/netadc/uwsgi/tmp/netadc.sock; # for a file socket
#server 127.0.0.1:8000; # for a web port socket (we'll use this first)
}
server {
#listen 443;
listen 443 ssl;
server_name x.x.x.x;
uwsgi_ignore_client_abort on;
#client timeouts
#client_body_timeout 600;
#client_header_timeout 600;
#keepalive_timeout 240;
#send_timeout 600;
#client buffer sizes
#client_body_buffer_size 1m;
#client_max_body_size 32m;
client_body_temp_path /apps/netadc/opt/nginx/root/var/log/nginx/client_body_temp;
ssl_certificate cert_path;
ssl_certificate_key key_path;
location /netadc/static {
alias /apps/netadc/static;
}
location /netadc/ {
uwsgi_pass django;
include /apps/netadc/netadc/uwsgi_params;# the uwsgi_params file you installed
uwsgi_read_timeout 7200;
uwsgi_send_timeout 7200;
proxy_read_timeout 3600;
#return 301 https://$host$request_uri;
#proxy_set_header X-Forwarded-Proto $scheme;
}
server {
listen 80;
server_name x.x.x.x;
uwsgi_ignore_client_abort on;
location /netadc/ {
return 301 https://$host$request_uri;
}
}
The uwsgi configuration file is the netadc_uwsgi.ini file i presume :-
# netadc_uwsgi.ini file
[uwsgi]
#uid = nginx
#gid = nginx
# Django-related settings
env = HTTPS=on
# the base directory (full path)
chdir = /apps/netadc
# Django's wsgi file
module = netadc.wsgi
# the virtualenv (full path)
home = home_path
# process-related settings
# master
master = true
# maximum number of worker processes
processes = 10
buffer-size = 65536
buffer-size = 32768
# the socket (use the full path to be safe
socket = /apps/netadc/netadc/uwsgi/tmp/netadc.sock
# read post data by default
post-buffering = 1
# ... with appropriate permissions - may be needed
#chmod-socket = 666
# daemonize
daemonize = true
# logging
logger = file:/apps/netadc/netadc/uwsgi/tmp/netadc_uwsgi.log
# clear environment on exit
vacuum = true
Command-line arguments:-
/apps/netadc/.venvs/netadc/bin/uwsgi --ini /apps/netadc/netadc/uwsgi/netadc_uwsgi.ini --enable-threads
Also another weird thing is find is some of the permissions changes after a week and some of my apps do not load.
[root#xxxxxxx ~]# ls -l /opt/rh/nginx16/root/var/lib/nginx/tmp/
total 20
drwxrwxr-x 2 my_username nginx 4096 Aug 20 10:27 client_body
drwxrwxr-x 2 my_username nginx 4096 Jan 21 2015 fastcgi
drwxrwxr-x 2 my_username nginx 4096 Jan 21 2015 proxy
drwxrwxr-x 2 my_username nginx 4096 Jan 21 2015 scgi
drwxrwxr-x 12 my_username nginx 4096 Sep 7 12:31 uwsgi
Until I change the above permissions to 777, the page takes forever to load. And then after a week, it randomly changes the permisions to the above 775. It's very bizarre. No infrastructure team is doing any changes, so I am sure something in nginx+uwsgi is messing this up.

django nginx uwsgi deploying fail

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.py I can see
I then installed en started Nginx:
sudo apt-get install nginx
sudo /etc/init.d/nginx start
I can see
and then wrote mysite_nginx.conf:
upstream django {
# server unix:///path/to/your/mysite/mysite.sock; # for a file socket
server 127.0.0.1:8001; # for a web port socket (we'll use this first)
}
# configuration of the server
server {
# the port your site will be served on
listen 8000;
# the domain name it will serve for
server_name 10.211.55.21; # substitute your machine's IP address or FQDN
charset utf-8;
# max upload size
client_max_body_size 75M; # adjust to taste
# Django media
#location /media {
# alias /path/to/your/mysite/media; # your Django project's media files - amend as required
#}
#location /static {
# alias /path/to/your/mysite/static; # your Django project's static files - amend as required
#}
# Finally, send all non-media requests to the Django server.
location / {
uwsgi_pass django;
include /home/parallels/books/mysite/uwsgi_params; # the uwsgi_params file you installed
}
}
because it is just a simple site I commented out the media and static paths, and uwsgi_params:
uwsgi_param QUERY_STRING $query_string;
uwsgi_param REQUEST_METHOD $request_method;
uwsgi_param CONTENT_TYPE $content_type;
uwsgi_param CONTENT_LENGTH $content_length;
uwsgi_param REQUEST_URI $request_uri;
uwsgi_param PATH_INFO $document_uri;
uwsgi_param DOCUMENT_ROOT $document_root;
uwsgi_param SERVER_PROTOCOL $server_protocol;
uwsgi_param REQUEST_SCHEME $scheme;
uwsgi_param HTTPS $https if_not_empty;
uwsgi_param REMOTE_ADDR $remote_addr;
uwsgi_param REMOTE_PORT $remote_port;
uwsgi_param SERVER_PORT $server_port;
uwsgi_param SERVER_NAME $server_name;
the directory:
and run:
sudo ln -s ~/home/parallels/books/mysite/mysite_nginx.conf
/etc/nginx/sites-enabled/
I can see mysite_nginx.conf within /etc/nginx/sites-enabled/:
and then run:
sudo /etc/init.d/nginx restart
uwsgi --socket :8001 --wsgi-file test.py
I see nothing in my webbrowser:
I do not know why, whenever I try deploying a Django site the socket part fails.
Finally I made it by using XML to configure uWSGI and deploying Django project successfully. However, this time I do not use a virtualenv.
I created the virtual host configuration /etc/nginx/sites-enabled/mysite:
server {
listen 80; ## listen for ipv4; this line is default and implied
#listen [::]:80 default ipv6only=on; ## listen for ipv6
server_name 10.211.55.21;
access_log /var/log/nginx/mysite-access.log ;
error_log /var/log/nginx/mysite-error.log ;
location / {
uwsgi_pass 127.0.0.1:8630;
include uwsgi_params;
}
}
Then created the /home/parallels/books/mysite/django.xml file, note that the name of the file can be anything but should end with *.xml:
<uwsgi>
<socket>127.0.0.1:8630</socket>
<chdir>/home/parallels/books/mysite/mysite</chdir>
<pythonpath>..</pythonpath>
<module>wsgi</module>
</uwsgi>
the <chdir>/home/parallels/books/mysite/mysite</chdir> just point to <module>wsgi</module> because there is a wsgi.py in /home/parallels/books/mysite/mysite/wsgi.py.
I then run the following commands:
$ sudo /etc/init.d/nginx restart
$ uwsgi -x django.xml
now the website is reachable:
But I fail to configure and deploying Django using uwsgi.ini.

Why is nginx returning a 502 when doing a `uwsgi_pass` to a linked docker container?

I'm using Docker Compose to orchestrate a multi-container app composed of both a Django webapp and an nginx reverse-proxy.
I'm staring with a simple test-case, but I've already hit a roadblock. The app should pass all requests to / over to the Django application by way of uwsgi_pass over a network socket (frontend:8000).
However, after starting the application with docker-compose up and seeing no error message, any request to / produces the following error message in the console: gateway_1 | 2016/01/11 15:45:12 [error] 8#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.99.1, server: localhost, request: "GET / HTTP/1.1", upstream: "uwsgi://172.17.0.2:8000", host: "192.168.99.100:8000"
My question is as follows: What might the problem be? Replacing uwsgi_pass frontend; in the location block with content_by_lua_file path/to/file.lua; behaves as expected, so I suspect a problem with uWSGI over a container link, but I'm at a loss for where to look next.
Below are the relevant files:
Docker Compose: the 30,000-ft view
The docker-compose.yml file is as follows:
postgres:
image: mystuff/app.testdb:latest
expose:
- "5432"
frontend:
image: mystuff/app.frontend:latest
expose:
- "8000"
environment:
APP_DBCONN: "user=xxx dbname=xxx port=5432 host=postgres sslmode=require password=xxx"
APP_ENV: "test"
gateway:
image: mystuff/app.gateway:latest
links:
- frontend
expose:
- "8000"
ports:
- "8000:8000"
NGINX: the reverse proxy
Below is my nginx.conf file:
worker_processes 1;
user me;
events {
use epoll;
worker_connections 1024;
}
http {
access_log /dev/stdout;
upstream frontend {
server frontend:8000; # assumption: `frontend` is a known hostname thanks to docker-compose
}
server {
listen 8000;
server_name localhost;
location / {
uwsgi_pass frontend;
include uwsgi_params;
}
}
}
And lastly, here is my uwsgi_params file:
uwsgi_param QUERY_STRING $query_string;
uwsgi_param REQUEST_METHOD $request_method;
uwsgi_param CONTENT_TYPE $content_type;
uwsgi_param CONTENT_LENGTH $content_length;
uwsgi_param REQUEST_URI $request_uri;
uwsgi_param PATH_INFO $document_uri;
uwsgi_param DOCUMENT_ROOT $document_root;
uwsgi_param SERVER_PROTOCOL $server_protocol;
uwsgi_param REQUEST_SCHEME $scheme;
uwsgi_param HTTPS $https if_not_empty;
uwsgi_param REMOTE_ADDR $remote_addr;
uwsgi_param REMOTE_PORT $remote_port;
uwsgi_param SERVER_PORT $server_port;
uwsgi_param SERVER_NAME $server_name;
uWSGI & Django: the application server
uwsgi.ini:
[uwsgi]
chdir = /home/app
wsgi-file = ./NFC/wsgi.py
socket = 127.0.0.1:8000
master = true
processes = 1
threads = 2
uid = me
Edits
1. Log output with http = 127.0.0.1:8000 in uwsgi.ini
$ cat /tmp/uwsgi.log
*** Starting uWSGI 2.0.12 (64bit) on [Wed Jan 13 12:09:44 2016] ***
compiled with version: 4.9.2 on 03 January 2016 21:09:04
os: Linux-4.1.13-boot2docker #1 SMP Fri Nov 20 19:05:50 UTC 2015
nodename: default
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 1
current working directory: /home/srg
detected binary path: /home/srg/.pyenv/versions/2.7.11/bin/uwsgi
chdir() to /home/srg
your processes number limit is 1048576
your memory page size is 4096 bytes
detected max file descriptor number: 1048576
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uWSGI http bound on 127.0.0.1:8000 fd 7
uwsgi socket 0 bound to TCP address 127.0.0.1:38922 (port auto-assigned) fd 6
Python version: 2.7.11 (default, Jan 3 2016, 21:07:12) [GCC 4.9.2]
Python main interpreter initialized at 0x1d37300
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 166144 bytes (162 KB) for 2 cores
*** Operational MODE: threaded ***
WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0x1d37300 pid: 173 (default app)
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 173)
spawned uWSGI worker 1 (pid: 210, cores: 2)
spawned uWSGI http 1 (pid: 211)
SIGINT/SIGQUIT received...killing workers...
gateway "uWSGI http 1" has been buried (pid: 211)
worker 1 buried after 1 seconds
goodbye to uWSGI.
With that uWSGI configuration, especially with:
socket = 127.0.0.1:8000
uWSGI will allow only local connection (which means from same docker, not from host or other dockers). To allow connections from outside of docker, you must change it to:
socket = :8000
Try adding the following property to your .ini config.
chmod-socket = 666