Hi,
First of all my site is up and running OK. There is no critical issues.
I want to understand a couple of things though.
I'll start with an overview of my system.
It's a django-powered site located on a CentOS 5.3 VPS with 256MB RAM, under apache with mod_wsgi.
The django application runs as a Daemon process with 1 threads.
What I need in my application is: 1. Initialize logging (currently it is working, but I get double logging every time) 2. Start to daemon threads to do some background work
Now, I have read and implemented the solution offered in http://blog.dscpl.com.au/2010/03/improved-wsgi-script-for-use-with.html but it didn't help much.
Basically I had to manually disable worker MPM (only prefork MPM is running) and configure the daemon process to be with one process and one thread (for some reason it does not work with any other combination).
But what is weird is that the site is running and it is creating the 2 background threads. 1. How does that happen? 2. Does my settings mean that concurrent requests will not be handled on my site?
Here is some configuration from my site
httpd.conf
WSGIScriptAlias / /var/www/NiceHouse/trunk/apache/django.wsgi
WSGISocketPrefix run/wsgi
<VirtualHost *:80>
WSGIDaemonProcess site-1 user=**** group=**** threads=1
WSGIProcessGroup site-1
ServerName *****
ServerAlias *****
ServerAdmin *****
#DocumentRoot /usr/local/www/documents
#Alias /robots.txt /usr/local/www/documents/robots.txt
#Alias /favicon.ico /usr/local/www/documents/favicon.ico
Alias /media/ /usr/lib/python2.4/site-packages/django/contrib/admin/media/
Alias /site_media/ /var/www/NiceHouse/trunk/media/
Alias /phpmyadmin /var/www/phpmyadmin/
#<Directory /usr/local/www/documents>
#Order allow,deny
#Allow from all
#</Directory>
WSGIScriptAlias / /var/www/NiceHouse/trunk/apache/django.wsgi
#<Directory /usr/local/www/wsgi-scripts>
#Order allow,deny
#Allow from all
#</Directory>
</VirtualHost>
swtune.conf
<IfModule prefork.c>
StartServers 1
MinSpareServers 1
MaxSpareServers 3
ServerLimit 50
MaxClients 50
MaxRequestsPerChild 1000
</IfModule>
django.wsgi
import sys
import os
os.environ['PYTHON_EGG_CACHE']='/tmp/hoge'
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
sys.path.insert(0,'/var/www/NiceHouse/trunk')
import settings
import django.core.management
django.core.management.setup_environ(settings)
utility = django.core.management.ManagementUtility()
command = utility.fetch_command('runserver')
command.validate()
import django.conf
import django.utils
django.utils.translation.activate(django.conf.settings.LANGUAGE_CODE)
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
I'll appreciate any help
Thanks, Elad