1
我有以下配置:wsgi啓動 - 爲什麼兩個相同的進程?
虛擬主機:
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName lh.test.com
WSGIScriptAlias//home/user/myapp/src/wsgi.py application-group='%{GLOBAL}' process-group='%{GLOBAL}'
WSGIDaemonProcess lh.test.com processes=1 threads=1 display-name=%{GROUP}
<Directory /home/user/myapp/src>
<Files wsgi.py>
Order deny,allow
Require all granted
</Files>
Options All
AllowOverride All
Require all granted
</Directory>
Alias /static /home/user/myapp/src/static
ErrorLog /var/log/apache2/lh.test.com-error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel debug
CustomLog /var/log/apache2/lh.test.com-access.log combined
</VirtualHost>
wsgi.py:
from __future__ import unicode_literals
import os, signal, sys
sys.path.append('/home/user/apps/django-trunk')
sys.path.insert(0, '/home/user/myapp/src')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test.settings")
print 'starting up wsgi application...'
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
當我啓動Apache時,開頭總是出於某種原因兩個相同的wsgi進程:
apache日誌:
Mon Jan 06 21:17:02.895219 2014] [mpm_event:notice] [pid 27628:tid 140594224048000] AH00489: Apache/2.4.6 (Ubuntu) mod_wsgi/3.4 Python/2.7.5+ configured -- resuming normal operations
[Mon Jan 06 21:17:02.895287 2014] [core:notice] [pid 27628:tid 140594224048000] AH00094: Command line: '/usr/sbin/apache2'
[Mon Jan 06 21:17:02.905771 2014] [:error] [pid 27632:tid 140594224048000] starting up wsgi application...
[Mon Jan 06 21:17:02.909542 2014] [:error] [pid 27633:tid 140594224048000] starting up wsgi application...
和PS AUX:
root 27628 0.0 0.0 84196 3100 ? Ss 21:17 0:00 /usr/sbin/apache2 -k start
www-data 27632 0.1 0.3 470984 24648 ? Sl 21:17 0:00 /usr/sbin/apache2 -k start
www-data 27633 0.1 0.3 470984 24648 ? Sl 21:17 0:00 /usr/sbin/apache2 -k start
任何想法,爲什麼會這樣?
謝謝格雷厄姆!這是一個改進,我仍然有兩個實例開始:[Tue Jan 07 18:24:05.311746 2014] [:info] [pid 11338:tid 139661808760704] mod_wsgi(pid = 11338,process ='lh.test.com',application =''):加載WSGI腳本'/home/user/myapp/src/wsgi.py'。 [Tue Jan 07 18:24:05.311746 2014] [:info] [pid 11339:tid 139661808760704] mod_wsgi(pid = 11339,process ='lh.test.com',application =''):加載WSGI腳本'/家庭/用戶/ MYAPP/src目錄/ wsgi.py」。 ,但現在至少與WSGIScriptAlias指令的processes = 2參數綁定。這可以嗎? – Rok
你的意思是,如果看到兩個,你實際上已經改變了WSGIDaemonProcess選項到進程= 2。如果您的流程= 1仍然如圖所示,則不應該有兩個。 –
是的,在進程= 2的情況下,我會立即開始兩個進程。我認爲這是有意的行爲? – Rok