title: hosting multiple Flask apps for unique domains
body: <p>I have two unique domains (eg. <code>domain1.com</code> and <code>domain2.com</code>). I am trying to host two unique webpages (via two separate flask apps) on one linode server (eg. <code>12.34.567.890</code>) using Flask.</p>
  
  <p>Currently, <code>domain1.com</code> works, but <code>domain2.com</code> gives me the Apache2 default page.</p>
  
  <p>Here's what I have so far:<br><br>
  etc\apache2\ports.conf:</p>
  
  <pre><code>Listen 80
  Listen 8080
  
  &lt;IfModule ssl_module&gt;
      Listen 443
  &lt;/IfModule&gt;
  
  &lt;IfModule mod_gnutls.c&gt;
      Listen 443
  &lt;/IfModule&gt;
  
  # vim: syntax=apache ts=4 sw=4 sts=4 sr noet
  </code></pre>
  
  <p><br>etc\apache2\sites-available\000-default.conf:</p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
      ServerAdmin webmaster@localhost
      DocumentRoot /var/www/html
      ErrorLog ${APACHE_LOG_DIR}/error.log
      CustomLog ${APACHE_LOG_DIR}/access.log combined
  &lt;/VirtualHost&gt;
  
  &lt;VirtualHost *:8080&gt;
      ServerAdmin webmaster@localhost
      DocumentRoot /var/www/html
      ErrorLog ${APACHE_LOG_DIR}/error.log
      CustomLog ${APACHE_LOG_DIR}/access.log combined
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p><br>etc\apache2\sites-available\FlaskApp.conf:</p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
              ServerName domain1.com
              ServerAdmin admin@email.com
              WSGIScriptAlias / /var/www/AppOne/flaskapp.wsgi
              &lt;Directory /var/www/AppOne/FlaskApp/&gt;
                      Order allow,deny
                      Allow from all
              &lt;/Directory&gt;
              Alias /static /var/www/AppOne/FlaskApp/static
              &lt;Directory /var/www/AppOne/FlaskApp/static/&gt;
                      Order allow,deny
                      Allow from all
              &lt;/Directory&gt;
              ErrorLog ${APACHE_LOG_DIR}/error.log
              LogLevel warn
              CustomLog ${APACHE_LOG_DIR}/access.log combined
  &lt;/VirtualHost&gt;
  
  &lt;VirtualHost *:8080&gt;
              ServerName domain2.com
              ServerAdmin admin@email.com
              WSGIScriptAlias / /var/www/AppTwo/flaskapp.wsgi
              &lt;Directory /var/www/AppTwo/FlaskApp/&gt;
                      Order allow,deny
                      Allow from all
              &lt;/Directory&gt;
              Alias /static /var/www/AppTwo/FlaskApp/static
              &lt;Directory /var/www/AppTwo/FlaskApp/static/&gt;
                      Order allow,deny
                      Allow from all
              &lt;/Directory&gt;
              ErrorLog ${APACHE_LOG_DIR}/error.log
              LogLevel warn
              CustomLog ${APACHE_LOG_DIR}/access.log combined
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p><br><code>__init__.py</code> for each app is the same (but in different directories):</p>
  
  <pre><code>from flask import Flask, render_template, flash, request, url_for, redirect, session
  from content_management import Content
  #...etc...
  import gc
  
  TOPIC_DICT = Content()
  
  app = Flask(__name__)
  
  @app.route('/')
  def homepage():
      return render_template("home.html")
  
  if __name__ == "__main__":
      app.run()
  </code></pre>
  
  <p><br>The \var\www\ directory looks like this:</p>
  
  <pre><code>\var\www
  |
  └─── AppOne
  |    |    flaskapp.wsgi
  |    |
  |    └─── FlaskApp
  |         |  __init__.py
  |         |
  |         └─── static
  |         └─── templates
  |         |        home.html
  |         |
  |         └─── venv
  |
  └─── AppTwo                  #same as AppOne
       |    flaskapp.wsgi
       |
       └─── FlaskApp
            |  __init__.py
            |
            └─── static
            └─── templates
            |        home.html
            |
            └─── venv
  </code></pre>
  
  <p>Sorry if I got a bit verbose, but any guidance would help!</p>