Score:0

mod_wsgi daemons not working

ph flag

I setup mod_wsgi on my ubuntu/apache2 server.

I'm trying to run threads but daemons do not work.

When I try to run them in the background, nothing happens.

My wsgi script:

import sys, logging
sys.path.insert(0, "/var/www/xxx/public_html/blockchain/")

from app import app as application

logging.basicConfig(filename'/var/www/xxx/blockchain/wsgi.log', level=logging.INFO, filemode='w')

My xxx.conf file is:

Listen 8888
<VirtualHost *:8888>
        ServerName xxx.com
        ServerAlias xxx.com
        ErrorLog /var/www/xxx/logs/error.log
        CustomLog /var/www/xxx/logs/acccess.log combined
        WSGIDaemonProcess xxx user=www-data group=www-data processes=5 threads=10
        WSGIProcessGroup xxx
        WSGIApplicationGroup %{GLOBAL}
        WSGIScriptAlias / /var/www/xxx/public_html/blockchain/xxx.wsgi
        Alias /static/ /var/www/xxx/public_html/blockchain/static
        <Directory /var/www/xxx/public_html/blockchain>
                Order allow,deny
                Allow from all
        </Directory>

</VirtualHost>

The relevant part o my python script is:

if __name__ == '__main__':

    t1 = threading.Thread(target=doFirstThing, daemon=True)
    t2 = threading.Thread(target=doSecondThing, daemon=True)
    t3 = threading.Thread(target=doThirdThing, daemon=True)

    t1.start()
    t2.start()
    t3.start()

    app.run(host='0.0.0.0', port='8888', debug=True)

How can I make my threads work int he background when my Flask file is launched using wsgi.

Thanks

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.