Hi Graham, thanks for getting back to me.

On Tue, Jun 11, 2013 at 8:46 PM, Graham Dumpleton <
[email protected]> wrote:

> Is the issue that you are expecting to see it started when Apache is
> started.
>

Yes, this is how I would like it to work, if it's possible.


>
> By default mod_wsgi will lazily load the WSGI script on the first request.
> This may be why you only see it then.
>

Yup, that appears to be exactly what is happening.


>
> Can you show me how you are configuring mod_wsgi? Eg., WSGIScriptAlias,
> WSGIDaemonProcess, WSGIProcessGroup directives etc.
>

> Having that can then show you how to tweak it to preload WSGI script when
> Apache first starts.
>

Here you go:
WSGIPythonHome /path/to/python
WSGIDaemonProcess my_app processes=4 threads=2 display-name=my_app
python-path=/python/path/to/modules
WSGIProcessGroup my_app
WSGIScriptAlias /my_app /path/to/main.wsgi

<Location /my_app >
WSGIProcessGroup my_app
</Location>

<Directory /my_app>
Order allow,deny
Allow from all
</Directory>


>
> Graham
>
> On 12/06/2013, at 2:27 AM, Josh Nathanson <[email protected]> wrote:
>
> On Mon, Jun 10, 2013 at 8:09 PM, Graham Dumpleton <
> [email protected]> wrote:
>
>> On 11/06/2013, at 11:13 AM, Josh Nathanson <[email protected]>
>> wrote:
>>
>> Hi Graham,  thanks for responding so quickly.
>>
>> On Mon, Jun 10, 2013 at 6:03 PM, Graham Dumpleton <
>> [email protected]> wrote:
>>
>>> Where are you starting the thread from?
>>>
>>
>> The thread is started in the main() function of the Pyramid app, like so:
>>
>> def main(global_config, **settings):
>>   # AMQPClient extends Thread
>>   amqp_client = amqp_client = AMQPClient(settings['amqp.host'])
>>   amqp_client.start()
>>
>>
>> And you have added print statements inside of that main() function to see
>> if it is executed?
>>
>> When running under mod_wsgi, the typical main() function that a web
>> application has to run a specific embedded WSGI server would not be run,
>> especially since such main() functions are only run if __name__ ==
>> '__main__', which wouldn't be the case under mod_wsgi.
>>
>> Can you provide more of the WSGI script file so I can see how when that
>> main() is run?
>>
>> Graham
>>
>
>
> Hi Graham,
>
> I added some print statements to the main function as you suggested, and
> lo and behold, it is not run when Apache is started up.  It seems like it
> is only run after the first http request hits the application.  After that
> the subthread starts up fine and works as expected.  I'm wondering if there
> is some way to get that function to fire, (or some function that can start
> the subthread), other than faking a request to the application?
>
> For reference the WSGI script file looks like this, it's very brief:
>
> ------
> from pyramid.paster import get_app
>
> application = get_app('/path/to/config.ini', 'main')
> ------
>
> Thanks again for your assistance.
>
> -- Josh
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "modwsgi" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/modwsgi?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "modwsgi" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/modwsgi?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/modwsgi?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to