(django2) root@Tony-PC:/opt/pywww/mysite# uwsgi --http :8001 --wsgi-file test.py *** Starting uWSGI 2.0.18 (64bit) on [Mon Aug 19 18:01:50 2019] *** compiled with version: 7.3.0 on 19 August 2019 06:30:34 os: Linux-4.15.0-29deepin-generic #31 SMP Fri Jul 27 07:12:08 UTC 2018 nodename: Tony-PC machine: x86_64 clock source: unix pcre jit disabled detected number of CPU cores: 8 current working directory: /opt/pywww/mysite detected binary path: /opt/pyenv/django2/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 31152 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 http bound on :8000 fd 4 spawned uWSGI http 1 (pid: 14213) uwsgi socket 0 bound to TCP address 127.0.0.1:42333 (port auto-assigned) 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.5 (default, May 11 2018, 13:30:17) [GCC 7.3.0] *** Python threads support is disabled. You can enable it with --enable-threads *** Python main interpreter initialized at 0x5629304088e0 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 72920 bytes (71 KB) for 1 cores *** Operational MODE: single process *** WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0x5629304088e0 pid: 14212 (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: 14212, cores: 1)
浏览器访问
1 2 3 4 5
# 控制台显示访问信息: [pid: 4864|app: 0|req: 1/1] 10.10.10.238 () {38 vars in 742 bytes} [Tue Aug 20 09:17:23 2019] GET / => generated 11 bytes in 0 msecs (HTTP/1.1 200 ) 1 headers in 44 bytes (1 switches on core 0) [pid: 4864|app: 0|req: 2/2] 10.10.10.238 () {38 vars in 691 bytes} [Tue Aug 20 09:17:23 2019] GET /favicon.ico => generated 11 bytes in 0 msecs (H TTP/1.1 200) 1 headers in 44 bytes (1 switches on core 0)
uwsgi测试django程序
代码准备
mysite/urls.py
1 2 3 4 5 6 7 8 9 10 11
from django.contrib import admin from django.urls import path from django.shortcuts import HttpResponse from blog import views defhello(request): return HttpResponse('你好,中国') urlpatterns = [ path('admin/', admin.site.urls), path('hello', hello), path('play', views.play) ]
*** Starting uWSGI 2.0.18 (64bit) on [Tue Aug 20 09:33:03 2019] *** compiled with version: 7.3.0 on 19 August 2019 06:30:34 os: Linux-4.15.0-29deepin-generic #31 SMP Fri Jul 27 07:12:08 UTC 2018 nodename: Tony-PC machine: x86_64 clock source: unix pcre jit disabled detected number of CPU cores: 8 current working directory: /opt/pywww/mysite detected binary path: /opt/pyenv/django2/bin/uwsgi uWSGI running as root, you can use --uid/--gid/--chroot options *** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** your processes number limit is 31152 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 http bound on :8003 fd 4 uwsgi socket 0 bound to TCP address 127.0.0.1:35147 (port auto-assigned) 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.5 (default, May 11 2018, 13:30:17) [GCC 7.3.0] Python main interpreter initialized at 0x555e54571920 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 145840 bytes (142 KB) for 1 cores *** Operational MODE: single process *** WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0x555e54571920 pid: 5586 (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: 5586) spawned uWSGI worker 1 (pid: 5588, cores: 1) spawned uWSGI http 1 (pid: 5589) Python auto-reloader enabled
访问程序
1 2 3
# 控制台显示访问信息: [pid: 5588|app: 0|req: 1/1] 10.10.10.238 () {38 vars in 752 bytes} [Tue Aug 20 01:40:32 2019] GET /hello => generated 13 bytes in 4 msecs (HTTP/1. 1 200) 3 headers in 108 bytes (1 switches on core 0)
*** Starting uWSGI 2.0.18 (64bit) on [Tue Aug 20 09:53:32 2019] *** compiled with version: 7.3.0 on 19 August 2019 06:30:34 os: Linux-4.15.0-29deepin-generic #31 SMP Fri Jul 27 07:12:08 UTC 2018 nodename: Tony-PC machine: x86_64 clock source: unix pcre jit disabled detected number of CPU cores: 8 current working directory: /opt/pywww/mysite detected binary path: /opt/pyenv/django2/bin/uwsgi uWSGI running as root, you can use --uid/--gid/--chroot options *** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** your processes number limit is 31152 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 :8002 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.5 (default, May 11 2018, 13:30:17) [GCC 7.3.0] Python main interpreter initialized at 0x55fd342b62f0 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 145840 bytes (142 KB) for 1 cores *** Operational MODE: single process *** WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0x55fd342b62f0 pid: 6695 (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: 6695) spawned uWSGI worker 1 (pid: 6697, cores: 1) Python auto-reloader enabled
访问程序
可能此时你还没意识到有什么问题,此时我们访问admin试一下
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
# 控制台用户访问信息 [pid: 6697|app: 0|req: 1/1] 10.10.10.238 () {42 vars in 739 bytes} [Tue Aug 20 01:59:59 2019] GET /play => generated 202 bytes in 9 msecs (HTTP/1. 1 200) 3 headers in 109 bytes (1 switches on core 0)Not Found: /static/css.css [pid: 6697|app: 0|req: 2/2] 10.10.10.238 () {40 vars in 628 bytes} [Tue Aug 20 01:59:59 2019] GET /static/css.css => generated 2183 bytes in 2 mse cs (HTTP/1.1 404) 3 headers in 102 bytes (1 switches on core 0) [pid: 6697|app: 0|req: 3/3] 10.10.10.238 () {40 vars in 710 bytes} [Tue Aug 20 02:00:43 2019] GET /admin => generated 0 bytes in 0 msecs (HTTP/1.1 301) 3 headers in 112 bytes (1 switches on core 0) [pid: 6697|app: 0|req: 4/4] 10.10.10.238 () {40 vars in 712 bytes} [Tue Aug 20 02:00:43 2019] GET /admin/ => generated 0 bytes in 6 msecs (HTTP/1. 1 302) 7 headers in 265 bytes (1 switches on core 0) [pid: 6697|app: 0|req: 5/5] 10.10.10.238 () {40 vars in 749 bytes} [Tue Aug 20 02:00:43 2019] GET /admin/login/?next=/admin/ => generated 1819 byt es in 21 msecs (HTTP/1.1 200) 7 headers in 395 bytes (1 switches on core 0)Not Found: /static/admin/css/base.css [pid: 6697|app: 0|req: 6/6] 10.10.10.238 () {42 vars in 760 bytes} [Tue Aug 20 02:00:43 2019] GET /static/admin/css/base.css => generated 2216 byt es in 2 msecs (HTTP/1.1 404) 3 headers in 102 bytes (1 switches on core 0)Not Found: /static/admin/css/login.css [pid: 6697|app: 0|req: 7/7] 10.10.10.238 () {42 vars in 762 bytes} [Tue Aug 20 02:00:43 2019] GET /static/admin/css/login.css => generated 2219 by tes in 1 msecs (HTTP/1.1 404) 3 headers in 102 bytes (1 switches on core 0)Not Found: /static/admin/css/responsive.css [pid: 6697|app: 0|req: 8/8] 10.10.10.238 () {42 vars in 772 bytes} [Tue Aug 20 02:00:43 2019] GET /static/admin/css/responsive.css => generated 22 34 bytes in 1 msecs (HTTP/1.1 404) 3 headers in 102 bytes (1 switches on core 0)
[uWSGI] getting INI configuration from mysite_uwsgi.ini *** Starting uWSGI 2.0.18 (64bit) on [Tue Aug 20 11:22:59 2019] *** compiled with version: 7.3.0 on 19 August 2019 06:30:34 os: Linux-4.15.0-29deepin-generic #31 SMP Fri Jul 27 07:12:08 UTC 2018 nodename: Tony-PC machine: x86_64 clock source: unix pcre jit disabled detected number of CPU cores: 8 current working directory: /opt/pyuwsgi detected binary path: /opt/pyenv/django2/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/pywww/mysite your processes number limit is 31152 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 0.0.0.0:8005 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.5 (default, May 11 2018, 13:30:17) [GCC 7.3.0] Set PythonHome to /opt/pyenv/django2 *** Python threads support is disabled. You can enable it with --enable-threads *** Python main interpreter initialized at 0x5601391f2b50 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 364600 bytes (356 KB) for 4 cores *** Operational MODE: preforking *** WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0x5601391f2b50 pid: 9744 (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: 9744) spawned uWSGI worker 1 (pid: 9746, cores: 1) spawned uWSGI worker 2 (pid: 9747, cores: 1) spawned uWSGI worker 3 (pid: 9748, cores: 1) spawned uWSGI worker 4 (pid: 9749, cores: 1)
Options: -c/--configuration -- configuration file path (default /etc/supervisord.conf) -h/--help -- print usage message and exit -i/--interactive -- start an interactive shell after executing commands -s/--serverurl URL -- URL on which supervisord server is listening (default "http://localhost:9001"). -u/--username -- username to use for authentication with server -p/--password -- password to use for authentication with server -r/--history-file -- keep a readline history (if readline is available)
action [arguments] -- see below
Actions are commands like "tail" or "stop". If -i is specified or no action is specified on the command line, a "shell" interpreting actions typed interactively is started. Use the action "help" to find out about available actions.