I want use Django 1.6 and Python 2.7 in pythonanywhere.com and I have a problem with admin site.
I use this tutorial
and when I start this page
I have
Not Found
The requested URL was not found on the server.
If you entered the URL manually please check your spelling and try again.
In Server log i had
2014-06-24 17:42:42 Tue Jun 24 17:42:42 2014 - received message 1 from emperor
2014-06-24 17:42:42 ...gracefully killing workers...
2014-06-24 17:42:42 Gracefully killing worker 1 (pid: 11706)...
2014-06-24 17:42:43 worker 1 buried after 1 seconds
2014-06-24 17:42:43 uWSGI: GAME OVER (insert coin)
2014-06-24 17:42:43 chdir(): No such file or directory [core/uwsgi.c line 1541]
2014-06-24 17:42:43 VACUUM: unix socket /var/sockets/daro822.pythonanywhere.com/socket removed.
2014-06-24 17:42:44 *** Starting uWSGI 2.0.5.1 (64bit) on [Tue Jun 24 17:42:43 2014] ***
2014-06-24 17:42:44 compiled with version: 4.8.1 on 05 June 2014 15:39:26
2014-06-24 17:42:44 os: Linux-3.11.0-22-generic #38-Ubuntu SMP Thu May 15 20:47:00 UTC 2014
2014-06-24 17:42:44 nodename: giles-liveweb6
2014-06-24 17:42:44 machine: x86_64
2014-06-24 17:42:44 clock source: unix
2014-06-24 17:42:44 pcre jit disabled
2014-06-24 17:42:44 detected number of CPU cores: 4
2014-06-24 17:42:44 current working directory: /etc/uwsgi/vassals
2014-06-24 17:42:44 detected binary path: /usr/local/bin/uwsgi
2014-06-24 17:42:44 using Linux cgroup /mnt/cgroups/cpu/user_types/free with mode 700
2014-06-24 17:42:44 assigned process 12031 to cgroup /mnt/cgroups/cpu/user_types/free/tasks
2014-06-24 17:42:44 using Linux cgroup /mnt/cgroups/cpuacct/users/daro822 with mode 700
2014-06-24 17:42:44 assigned process 12031 to cgroup /mnt/cgroups/cpuacct/users/daro822/tasks
2014-06-24 17:42:44 using Linux cgroup /mnt/cgroups/memory/user_types/free with mode 700
2014-06-24 17:42:44 assigned process 12031 to cgroup /mnt/cgroups/memory/user_types/free/tasks
2014-06-24 17:42:44 uWSGI running as root, you can use --uid/--gid/--chroot options
2014-06-24 17:42:44 chroot() to /mnt/chroots/daro822
2014-06-24 17:42:44 setgid() to 60000
2014-06-24 17:42:44 setuid() to 327191
2014-06-24 17:42:44 limiting number of processes to 15...
2014-06-24 17:42:44 your processes number limit is 15
2014-06-24 17:42:44 your memory page size is 4096 bytes
2014-06-24 17:42:44 detected max file descriptor number: 123456
2014-06-24 17:42:44 building mime-types dictionary from file /etc/mime.types...
2014-06-24 17:42:44 536 entry found
2014-06-24 17:42:44 lock engine: pthread robust mutexes
2014-06-24 17:42:44 thunder lock: disabled (you can enable it with --thunder-lock)
2014-06-24 17:42:44 uwsgi socket 0 bound to UNIX address /var/sockets/daro822.pythonanywhere.com/socket fd 7
2014-06-24 17:42:44 Python version: 2.7.5+ (default, Feb 27 2014, 19:40:54) [GCC 4.8.1]
2014-06-24 17:42:44 *** Python threads support is disabled. You can enable it with --enable-threads ***
2014-06-24 17:42:44 Python main interpreter initialized at 0x23507e0
2014-06-24 17:42:44 your server socket listen backlog is limited to 100 connections
2014-06-24 17:42:44 your mercy for graceful operations on workers is 60 seconds
2014-06-24 17:42:44 setting request body buffering size to 65536 bytes
2014-06-24 17:42:44 mapped 333952 bytes (326 KB) for 1 cores
2014-06-24 17:42:44 *** Operational MODE: single process ***
2014-06-24 17:42:44 WSGI app 0 (mountpoint='') ready in 1 seconds on interpreter 0x23507e0 pid: 12031 (default app)
2014-06-24 17:42:44 *** uWSGI is running in multiple interpreter mode ***
2014-06-24 17:42:44 spawned uWSGI master process (pid: 12031)
2014-06-24 17:42:44 spawned uWSGI worker 1 (pid: 12032, cores: 1)
2014-06-24 17:42:44 spawned 2 offload threads for uWSGI worker 1
2014-06-24 17:42:45 announcing my loyalty to the Emperor...
Related
I have a Django application running with uWSGI.
Sometimes, when restarting the uWSGI service, I get a bunch of *** SIGNAL QUEUE IS FULL: buffer size 212992 bytes (you can tune it with --signal-bufsize) *** errors.
When that happens, I'm unable to access the Django app. Restarting uWSGI again usually works.
Any ideas what happening here?
On startup of my application, I have a bunch of crons and timers that are initialized, like:
#uwsgidecorators.timer(30)
def send_queued_mail(*args, **kwargs):
...
The full output of the wsgi process is below:
chdir() to /etc/uwsgi/vassals
closing all non-uwsgi socket fds > 2 (max_fd = 1024)...
found fd 3 mapped to socket 0 (/var/run/uwsgi/MY_APP.sock)
running /usr/local/bin/uwsgi
*** has_emperor mode detected (fd: 7) ***
[uWSGI] getting INI configuration from MY_APP.ini
*** Starting uWSGI 2.0.17.1 (64bit) on [Thu Feb 6 22:22:18 2020] ***
compiled with version: 4.8.4 on 07 August 2018 17:29:43
os: Linux-4.2.0-42-generic #49~14.04.1-Ubuntu SMP Wed Jun 29 20:22:11 UTC 2016
nodename: spuzzum
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 4
current working directory: /etc/uwsgi/vassals
detected binary path: /usr/local/bin/uwsgi
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
chdir() to /opt/MY_APP
your processes number limit is 128614
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 inherited UNIX address /var/run/uwsgi/MY_APP.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.6.7 (default, Oct 21 2018, 00:00:00) [GCC 4.8.4]
Set PythonHome to /opt/MY_APP/venv/MY_APP-3.6
Python main interpreter initialized at 0x24b1a00
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
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 609552 bytes (595 KB) for 5 cores
*** Operational MODE: preforking ***
*** Starting uWSGI 2.0.17.1 (64bit) on [Thu Feb 6 22:22:21 2020] ***
compiled with version: 4.8.4 on 07 August 2018 17:29:43
os: Linux-4.2.0-42-generic #49~14.04.1-Ubuntu SMP Wed Jun 29 20:22:11 UTC 2016
nodename: spuzzum
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 4
current working directory: /etc/uwsgi/vassals
detected binary path: /usr/local/bin/uwsgi
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
chdir() to /opt/MY_APP
your processes number limit is 128614
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 inherited UNIX address /var/run/uwsgi/MY_APP.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.6.7 (default, Oct 21 2018, 00:00:00) [GCC 4.8.4]
Set PythonHome to /opt/MY_APP/venv/MY_APP-3.6
Python main interpreter initialized at 0x24b1a00
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
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 609552 bytes (595 KB) for 5 cores
*** Operational MODE: preforking ***
*** Starting uWSGI 2.0.17.1 (64bit) on [Thu Feb 6 22:22:21 2020] ***
compiled with version: 4.8.4 on 07 August 2018 17:29:43
os: Linux-4.2.0-42-generic #49~14.04.1-Ubuntu SMP Wed Jun 29 20:22:11 UTC 2016
nodename: spuzzum
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 4
current working directory: /etc/uwsgi/vassals
detected binary path: /usr/local/bin/uwsgi
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
chdir() to /opt/MY_APP
your processes number limit is 128614
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 /var/run/uwsgi/MY_APP.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.6.7 (default, Oct 21 2018, 00:00:00) [GCC 4.8.4]
Set PythonHome to /opt/MY_APP/venv/MY_APP-3.6
Python main interpreter initialized at 0x10899e0
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
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 609552 bytes (595 KB) for 5 cores
*** Operational MODE: preforking ***
*** has_emperor mode detected (fd: 7) ***
unable to load configuration from from multiprocessing.semaphore_tracker import main;main(17)
[uwsgi-signal] signum 0 registered (wid: 0 modifier1: 0 target: default, any worker)
[uwsgi-signal] signum 1 registered (wid: 0 modifier1: 0 target: default, any worker)
[uwsgi-signal] signum 2 registered (wid: 0 modifier1: 0 target: default, any worker)
[uwsgi-signal] signum 3 registered (wid: 0 modifier1: 0 target: default, any worker)
[uwsgi-signal] signum 4 registered (wid: 0 modifier1: 0 target: default, any worker)
[uwsgi-signal] signum 5 registered (wid: 0 modifier1: 0 target: default, any worker)
[uwsgi-signal] signum 6 registered (wid: 0 modifier1: 0 target: default, any worker)
[uwsgi-signal] signum 7 registered (wid: 0 modifier1: 0 target: default, any worker)
[uwsgi-signal] signum 8 registered (wid: 0 modifier1: 0 target: default, any worker)
[uwsgi-signal] signum 9 registered (wid: 0 modifier1: 0 target: default, any worker)
[uwsgi-signal] signum 10 registered (wid: 0 modifier1: 0 target: default, any worker)
[uwsgi-signal] signum 11 registered (wid: 0 modifier1: 0 target: default, any worker)
[uwsgi-signal] signum 12 registered (wid: 0 modifier1: 0 target: default, any worker)
[uwsgi-signal] signum 13 registered (wid: 0 modifier1: 0 target: default, any worker)
[uwsgi-signal] signum 14 registered (wid: 0 modifier1: 0 target: default, any worker)
[uwsgi-signal] signum 15 registered (wid: 0 modifier1: 0 target: default, any worker)
[uwsgi-signal] signum 16 registered (wid: 0 modifier1: 0 target: default, any worker)
WSGI app 0 (mountpoint='') ready in 11 seconds on interpreter 0x10899e0 pid: 8515 (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 master process (pid: 8515)
spawned uWSGI worker 1 (pid: 8548, cores: 1)
spawned uWSGI worker 2 (pid: 8549, cores: 1)
spawned uWSGI worker 3 (pid: 8550, cores: 1)
spawned uWSGI worker 4 (pid: 8551, cores: 1)
spawned uWSGI worker 5 (pid: 8552, cores: 1)
*** Stats server enabled on /tmp/MY_APP-stats.socket fd: 23 ***
subprocess 8540 exited with code 1
*** SIGNAL QUEUE IS FULL: buffer size 212992 bytes (you can tune it with --signal-bufsize) ***
could not deliver signal 14 to workers pool
*** SIGNAL QUEUE IS FULL: buffer size 212992 bytes (you can tune it with --signal-bufsize) ***
could not deliver signal 0 to workers pool
*** SIGNAL QUEUE IS FULL: buffer size 212992 bytes (you can tune it with --signal-bufsize) ***
could not deliver signal 0 to workers pool
*** SIGNAL QUEUE IS FULL: buffer size 212992 bytes (you can tune it with --signal-bufsize) ***
could not deliver signal 13 to workers pool
*** SIGNAL QUEUE IS FULL: buffer size 212992 bytes (you can tune it with --signal-bufsize) ***
could not deliver signal 14 to workers pool
*** SIGNAL QUEUE IS FULL: buffer size 212992 bytes (you can tune it with --signal-bufsize) ***
It seems like issue may have arisen from duplicate timers. The solution is to import the timers before the loading of my WSGI app. My uwsgi ini file now looks like:
[uwsgi]
# Django-related settings
# the base directory (full path)
chdir = /opt/%n
# Django's wsgi file
module = MY_APP.wsgi
import = MY_APP.processes.production
...
where MY_APP.processes.production contains all of my .cron and .timer declarations.
This was suggested to me in https://github.com/unbit/uwsgi/issues/2123 and is also found in the first example from the documentation: https://uwsgi-docs.readthedocs.io/en/latest/PythonDecorators.html.
I'm trying to setup a simple Django project with Nginx, uWSGI on my Centos7-Server with this Tutorial:
How to Serve Django Applications with uWSGI and Nginx on CentOS 7
But I've tried to change this project into running Django 2 with Python 3.6
Everything worked pretty well, till creating firstsite.ini file.
1 [uwsgi]
2 project = firstsite
3 username = user
4 base = /home/%(username)
5 plugins-dir = /usr/lib64/uwsgi/
6 plugin = python36
7 virtualenv = %(base)/Env/%(project)
8 chdir = %(base)/%(project)
9 home = %(base)/Env/%(project)
10 module = %(project).wsgi:application
11
12 master = true
13 processes = 5
14
15 uid = %(username)
16 socket = /run/uwsgi/%(project).sock
17 chown-socket = %(username):nginx
18 chmod-socket = 660
19 vacuum = true
There I got stuck into. While setting up and trying to reach the Django Site I got an Internal Server Error. After checking error-log files and messages, I've implemented logto into my .ini file::
21 #Error Logs
22 logto = %(base)/%(project)/error.log
after checking this file it tells me this Error-Message::
*** Starting uWSGI 2.0.18 (64bit) on [Wed Aug 14 13:27:24 2019] ***
compiled with version: 4.8.5 20150623 (Red Hat 4.8.5-36) on 23 July 2019 10:27:56
os: Linux-3.10.0-957.21.3.el7.x86_64 #1 SMP Tue Jun 18 16:35:19 UTC 2019
nodename: ip-172-31-34-37.eu-central-1.compute.internal
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 1
current working directory: /etc/uwsgi/sites
detected binary path: /usr/bin/uwsgi
chdir() to /home/user/firstsite
your processes number limit is 3775
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 /run/uwsgi/firstsite.sock fd 3
setuid() to 1001
Python version: 2.7.5 (default, Jun 20 2019, 20:27:34) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]
Set PythonHome to /home/user/Env/firstsite
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x234f0e0
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 437520 bytes (427 KB) for 5 cores
*** Operational MODE: preforking ***
Traceback (most recent call last):
File "./firstsite/wsgi.py", line 12, in <module>
from django.core.wsgi import get_wsgi_application
ImportError: No module named django.core.wsgi
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 21976)
spawned uWSGI worker 1 (pid: 21978, cores: 1)
spawned uWSGI worker 2 (pid: 21979, cores: 1)
spawned uWSGI worker 3 (pid: 21980, cores: 1)
spawned uWSGI worker 4 (pid: 21981, cores: 1)
spawned uWSGI worker 5 (pid: 21982, cores: 1)
If I manually try to get this django project runing with the same Env, there is no problem. So I thought that it could be because of the fact that uwsgi is running Python 2.7.5 instead of Python 3.6.
I also checked the plugin python with uwsgi --plugin python36 -s:0
*** Starting uWSGI 2.0.18 (64bit) on [Thu Aug 15 04:16:19 2019] ***
compiled with version: 4.8.5 20150623 (Red Hat 4.8.5-36) on 14 August 2019 14:16:35
os: Linux-3.10.0-957.21.3.el7.x86_64 #1 SMP Tue Jun 18 16:35:19 UTC 2019
nodename: ip-172-31-34-37.eu-central-1.compute.internal
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 1
current working directory: /usr/lib64/uwsgi
detected binary path: /usr/local/bin/uwsgi
*** WARNING: you are running uWSGI without its master process manager ***
your processes number limit is 3775
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 :37796 (port auto-assigned) fd 3
Python version: 3.6.8 (default, Apr 25 2019, 21:02:35) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x17756c0
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 72920 bytes (71 KB) for 1 cores
*** Operational MODE: single process ***
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI worker 1 (and the only) (pid: 6476, cores: 1)
So it looks to me, that I've created my 36-plugin the right way.
Would be really grateful if someone could help me out.
this is where the real problem is it can't find django
are you sure that django is installed in that environment you mentioned?
i mean "Env"
Traceback (most recent call last):
File "./firstsite/wsgi.py", line 12, in <module>
from django.core.wsgi import get_wsgi_application
ImportError: No module named django.core.wsgi
in that link you mentioned i couldn't find
virtualenv = %(base)/Env/%(project)
try changing it to
virtualenv = %(base)/Env
if that didnt solve your problem please specify django, python versions you are using plus your project structure
in a nutshell I am getting the following error message from uWSGI when I try to test my installation against the examples found here:
$ uwsgi --socket 127.0.0.1:3031 --chdir /home/user/~Env/proj0/proj0 --wsgi-file wsgi.py --master --processes 4 --threads 2 --stats 127.0.0.1:9191
*** Starting uWSGI 2.0.15 (64bit) on [Wed May 31 14:10:35 2017] ***
compiled with version: 4.8.5 20150623 (Red Hat 4.8.5-11) on 30 May 2017 20:50:53
os: Linux-3.10.0-514.10.2.el7.x86_64 #1 SMP Fri Mar 3 00:04:05 UTC 2017
nodename: echo.com
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 2
current working directory: /home/user/~Env
detected binary path: /usr/local/bin/uwsgi
chdir() to /home/user/~Env/proj0/proj0
your processes number limit is 4096
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 127.0.0.1:3031 fd 3
Python version: 3.6.1 (default, May 29 2017, 14:21:37) [GCC 4.8.5 20150623
(Red Hat 4.8.5-11)]
Python main interpreter initialized at 0x1639580
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 415360 bytes (405 KB) for 8 cores
*** Operational MODE: preforking+threaded ***
Traceback (most recent call last):
File "wsgi.py", line 12, in <module>
from django.core.wsgi import get_wsgi_application
ModuleNotFoundError: No module named 'django'
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 20065)
spawned uWSGI worker 1 (pid: 20066, cores: 2)
spawned uWSGI worker 2 (pid: 20067, cores: 2)
spawned uWSGI worker 3 (pid: 20068, cores: 2)
spawned uWSGI worker 4 (pid: 20069, cores: 2)
*** Stats server enabled on 127.0.0.1:9191 fd: 15 ***
So obviously it found my wsgi.py file, but not Django. I'm not sure if I screwed up installing uWSGI system wide, my virtualenv folder layout, or whatever. I had wanted to deploy my app soon, but this takes precedence since I want to use nginx and uWSGI. My directory structure:
~Env---
projectenv proj0
bin proj0
include __init__.py
libs __pycache__
. settings.py
urls.py
views.py
wsgi.py
Any help at this point would be great. Thanks.
It doesn't look like it's using a Python interpreter that has Django installed, so it's probably not seeing your virtualenv.
Did you take the appropriate step to add your virtualenv to uwsgi options?
https://uwsgi-docs.readthedocs.io/en/latest/WSGIquickstart.html#virtualenvs
Setting up django to use uwsgi I can run it using the command uwsgi --ini kb_uwsgi.ini --http :8000 outside the virtualenv however trying to run the emperor command sudo uwsgi --emperor /etc/uwsgi/vassals --uid www-data --gid www-data brings an error:
ubuntu#ip-172-31-16-133:/etc/uwsgi/vassals$ ls
kb_uwsgi.ini
ubuntu#ip-172-31-16-133:/etc/uwsgi/vassals$ sudo uwsgi --emperor /etc/uwsgi/vassals --uid www-data --gid www-data
*** Starting uWSGI 2.0.14 (64bit) on [Mon Jan 30 10:28:11 2017] ***
compiled with version: 5.4.0 20160609 on 06 January 2017 11:55:37
os: Linux-4.4.0-53-generic #74-Ubuntu SMP Fri Dec 2 15:59:10 UTC 2016
nodename: ip-172-31-16-133
machine: x86_64
clock source: unix
detected number of CPU cores: 4
current working directory: /etc/uwsgi/vassals
detected binary path: /usr/local/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
setgid() to 33
setuid() to 33
*** WARNING: you are running uWSGI without its master process manager ***
your processes number limit is 64137
your memory page size is 4096 bytes
detected max file descriptor number: 1024
*** starting uWSGI Emperor ***
*** has_emperor mode detected (fd: 6) ***
[uWSGI] getting INI configuration from kb_uwsgi.ini
*** Starting uWSGI 2.0.14 (64bit) on [Mon Jan 30 10:28:11 2017] ***
compiled with version: 5.4.0 20160609 on 06 January 2017 11:55:37
os: Linux-4.4.0-53-generic #74-Ubuntu SMP Fri Dec 2 15:59:10 UTC 2016
nodename: ip-172-31-16-133
machine: x86_64
clock source: unix
detected number of CPU cores: 4
current working directory: /etc/uwsgi/vassals
detected binary path: /usr/local/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
chdir() to /home/ubuntu/webapps/kenyabuzz
your processes number limit is 64137
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)
bind(): Permission denied [core/socket.c line 769]
Mon Jan 30 10:28:11 2017 - [emperor] curse the uwsgi instance kb_uwsgi.ini (pid: 25612)
Mon Jan 30 10:28:14 2017 - [emperor] removed uwsgi instance kb_uwsgi.ini
*** has_emperor mode detected (fd: 6) ***
[uWSGI] getting INI configuration from kb_uwsgi.ini
*** Starting uWSGI 2.0.14 (64bit) on [Mon Jan 30 10:28:16 2017] ***
compiled with version: 5.4.0 20160609 on 06 January 2017 11:55:37
os: Linux-4.4.0-53-generic #74-Ubuntu SMP Fri Dec 2 15:59:10 UTC 2016
nodename: ip-172-31-16-133
machine: x86_64
clock source: unix
detected number of CPU cores: 4
current working directory: /etc/uwsgi/vassals
detected binary path: /usr/local/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
chdir() to /home/ubuntu/webapps/kenyabuzz
your processes number limit is 64137
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)
bind(): Permission denied [core/socket.c line 769]
Mon Jan 30 10:28:16 2017 - [emperor] curse the uwsgi instance kb_uwsgi.ini (pid: 25613)
Mon Jan 30 10:28:19 2017 - [emperor] removed uwsgi instance kb_uwsgi.ini
*** has_emperor mode detected (fd: 6) ***
[uWSGI] getting INI configuration from kb_uwsgi.ini
*** Starting uWSGI 2.0.14 (64bit) on [Mon Jan 30 10:28:22 2017] ***
compiled with version: 5.4.0 20160609 on 06 January 2017 11:55:37
os: Linux-4.4.0-53-generic #74-Ubuntu SMP Fri Dec 2 15:59:10 UTC 2016
nodename: ip-172-31-16-133
machine: x86_64
clock source: unix
detected number of CPU cores: 4
current working directory: /etc/uwsgi/vassals
detected binary path: /usr/local/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
chdir() to /home/ubuntu/webapps/kenyabuzz
your processes number limit is 64137
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)
bind(): Permission denied [core/socket.c line 769]
Mon Jan 30 10:28:22 2017 - [emperor] curse the uwsgi instance kb_uwsgi.ini (pid: 25614)
^C[emperor] *** RAGNAROK EVOKED ***
Mon Jan 30 10:28:25 2017 - [emperor] removed uwsgi instance kb_uwsgi.ini
Mon Jan 30 10:28:25 2017 - [emperor] unloyal bad behaving vassal found: kb_uwsgi.ini throttling it...
Mon Jan 30 10:28:25 2017 - The Emperor is buried.
Here's the uwsgi file
# kb_uwsgi.ini file
[uwsgi]
http = :80
# Django-related settings
# the base directory (full path)
chdir = /home/ubuntu/webapps/kenyabuzz
# Django's wsgi file
module = kb.wsgi
# the virtualenv (full path)
home = /home/ubuntu/webapps/djangoenv
# process-related settings
# master
master = true
# maximum number of worker processes
processes = 10
# the socket (use the full path to be safe
socket = /tmp/kb.sock
# ... with appropriate permissions - may be needed
chmod-socket = 664
# clear environment on exit
#vacuum = true
In the uwsgi file http port 80 is configured. By default, normal users are not allowed to bind to this port. That is why you are getting bind(): Permission denied. You can either give permission to the www-data user to use that port or use a different port.
I wasted many time but couldn't find a solution. Ask for help.
I use ubuntu server 14.04, setup uwsgi by:
pip3 install uwsgi
Then I create the test.py:
def application(env, start_response):
start_response('200 OK', [('Content-Type','text/html')])
return [b"Hello World"]
After I run:
uwsgi --http :8001 --wsgi-file test.py
It shows:
*** Starting uWSGI 2.0.12 (64bit) on [Sat Mar 26 13:06:41 2016] ***
compiled with version: 4.8.4 on 26 March 2016 09:06:13
os: Linux-3.13.0-65-generic #106-Ubuntu SMP Fri Oct 2 22:08:27 UTC 2015
nodename: iZ282na6z2kZ
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 1
current working directory: /home
detected binary path: /usr/local/bin/uwsgi
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 15834
your memory page size is 4096 bytes
detected max file descriptor number: 65535
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uWSGI http bound on :8001 fd 4
spawned uWSGI http 1 (pid: 24498)
uwsgi socket 0 bound to TCP address 127.0.0.1:57629 (port auto-assigned) fd 3
Python version: 3.4.3 (default, Oct 14 2015, 20:31:36) [GCC 4.8.4]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x16fa3b0
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 72760 bytes (71 KB) for 1 cores
*** Operational MODE: single process ***
File "test.py", line 3
return [b'Hello World']
^
SyntaxError: invalid syntax
failed to parse file test.py
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI worker 1 (and the only) (pid: 24497, cores: 1)
Why there is a syntax error for python3?
P.S sorry for my English :P