Score:0

Running multiple flask applications with different domain names using mod_wsgi

ru flag

We are trying to run 2 different flask applications with different domain names from same server using mod_wsgi + Apache2.

This is the settings configured in httpd.conf

# For www.yyy.com
WSGIDaemonProcess yyy python-path=/var/www/yyy
WSGIScriptAlias / /var/www/yy/wsgi.py process-group=yyy application-group=%{GLOBAL}

# For www.zzz.com
WSGIDaemonProcess zzz python-path=/var/www/zzz
WSGIScriptAlias / /var/www/zzz/wsgi.py process-group=zzz application-group=%{GLOBAL}

and created /etc/httpd/conf.d/yyy.conf & zzz.conf similar to

<VirtualHost *:80>
        ServerName www.yyy.com
        ServerAdmin joel
        DocumentRoot /var/www/yyy
        ErrorLog /var/log/httpd/error.log
        CustomLog /var/log/httpd/access.log combined
        Alias /static /var/www/yyy/static
        <Directory /var/www/yyy/static>
                Require all granted
        </Directory>
        <Directory /var/www/yyy>
        <Files wsgi.py>
                Require all granted
        </Files>
        </Directory>
</VirtualHost>

but whatever we try we end up getting only first application that is configured in httpd.conf.

cn flag
Can you share both apache config files? Also, how are you enabling them, are they in sites-available?
Score:0
ru flag

My query was answered by Graham Dumpleton, mod_wsgi mailing list. He asked me to remove all mod_wsgi settings from httpd.conf and move them in virtualhost config file /etc/httpd/conf.d/yyy.conf and zzz.conf as

<VirtualHost *:80>
        ServerName www.yyy.com
        ServerAdmin joel
        DocumentRoot /var/www/yyy
        ErrorLog /var/log/httpd/error.log
        CustomLog /var/log/httpd/access.log combined
        WSGIDaemonProcess yyy python-path=/var/www/yyy
        WSGIScriptAlias / /var/www/yy/wsgi.py process-group=yyy application-group=%{GLOBAL}
        Alias /static /var/www/yyy/static
        <Directory /var/www/yyy/static>
                Require all granted
        </Directory>
        <Directory /var/www/yyy>
        <Files wsgi.py>
                Require all granted
        </Files>
        </Directory>
</VirtualHost>
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.