Simple VirtualHost configuration for Python Flask

Posted by Arthur Barros on October 26, 2015

During this whole year, I’ve been involved in several web app using Flask, and several vhost configuration type.

The most problematic one was the WSGIDaemon, wich lets Apache to fireup N daemon of you application, this approach could lead for a database issues (which did). A quick google will show for some cases – stackoverflow

The following is currently the one who fits my needs

<VirtualHost *:80>
        ServerName my_awesome_site.com.br

        WSGIScriptAlias / /path/to/app/application.wsgi
        <Directory /path/to/app/>
            Order allow,deny
            Allow from all
        </Directory>
        Alias /static /path/to/app/static
        <Directory /path/to/app/static/>
            Order allow,deny
            Allow from all
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        LogLevel warn
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>