Read: http://code.google.com/p/modwsgi/wiki/ProcessesAndThreading
Embedded mode on UNIX is always going to be multiprocess, thus these are likely the script being loaded in different processes. Specifically, one will be the original page and the other a request for static resources via the application or a request for favicon.ico by the browser. Print out the value of os.getpid() so you can see which process. Further comments below. On 22 March 2011 01:53, Eric Lemoine <[email protected]> wrote: > Hi > > I'm using mod_wsgi 2.3 in embedded mode with a Pylons app, Unless you have a good reason to use embedded mode, it is always better to use daemon mode. You mod_wsgi is also way out of date and has a known issue with wsgi.file_wrapper. You should really upgrade. > and > observing that mod_wsgi executes my wsgi script twice on the first > request. > > Here's my wsgi script: > > --- > import site > import os, sys > > site.addsitedir('/home/elemoine/.virtualenvs/mf-perf-test/lib/python2.6/site-packages') > > sys.path.append('/home/elemoine/public_html/mapfish/PerfTestProject') > os.environ['PYTHON_EGG_CACHE'] = '/tmp/python-eggs' > > from paste.script.util.logging_config import fileConfig > fileConfig('/home/elemoine/public_html/mapfish/PerfTestProject/development.ini') > > from paste.deploy import loadapp > print 'XXX loadapp XXXX' > application = > loadapp('config:/home/elemoine/public_html/mapfish/PerfTestProject/development.ini') > --- > > The first produces this output in the Apache logs: > > [Mon Mar 21 15:41:12 2011] [error] XXX loadapp XXXX > [Mon Mar 21 15:41:13 2011] [error] XXX loadapp XXXX > > > Is it expected? Are there specific conditions that make this happen? > > Here's my Apache config: > > --- > WSGIScriptReloading Off If you use daemon mode and leave this directive out, then you get easy source code reloading. See: http://code.google.com/p/modwsgi/wiki/ReloadingSourceCode > WSGIScriptAlias /perftestproject > /home/elemoine/public_html/mapfish/PerfTestProject/wsgi Which indicates at least that not favicon.ico as you would need to be mounting at '/' to be that. BTW, is your WSGI script file really called just 'wsgi'? > --- > > (I also have WSGIRestrictStdout Off in the global Apache config, for > my print statement to work) If you use mod_wsgi 3.X you do not need to set that directive as blocking it is no longer the default. You still shouldn't be using 'print ...' though and instead should use 'print >> sys.stderr, ...'. See: http://code.google.com/p/modwsgi/wiki/DebuggingTechniques#Apache_Error_Log_Files http://blog.dscpl.com.au/2009/04/wsgi-and-printing-to-standard-output.html > Thanks for any insight on this. Also check the Apache access log as it will show what requests arrive. You can also use: http://code.google.com/p/modwsgi/wiki/DebuggingTechniques#Tracking_Request_and_Response to wrap WSGI application entry point and record what requests are coming in. Graham -- You received this message because you are subscribed to the Google Groups "modwsgi" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/modwsgi?hl=en.
