title: WSGI can't find file in same directory in app
body: <p>I'm trying to set up a Ubuntu server with apache2 and wsgi but I get a 500 internal error. WSGI can't find the file "client_secrets.json".</p>
  
  <p>App structure</p>
  
  <pre><code>/var/www/FlaskApp/
    flaskapp.wsgi
    - FlaskApp
        - static
          // All js, css, imgs and fonts
        - templates
          // All templates in here
        __init__.py
        client_secrets.json
        database_setup.py
        starter_content.py
  </code></pre>
  
  <p><strong>init</strong>.py</p>
  
  <pre><code>app = Flask(__name__)
  
  CLIENT_ID = json.loads(
      open('client_secrets.json', 'r').read())['web']['client_id']
  APPLICATION_NAME = "Catalog App"
  
  if __name__ == '__main__':
      app.secret_key = 'super_secret_key'
      app.debug = True
      app.run(host='0.0.0.0', port=5000)
  </code></pre>
  
  <p>flaskapp.wsgi:</p>
  
  <pre><code>#!/usr/bin/python
  import sys
  import logging
  logging.basicConfig(stream=sys.stderr)
  sys.path.insert(0,"/var/www/FlaskApp/")
  
  from FlaskApp import app as application
  application.secret_key = 'MY_SECRET_KEY'
  </code></pre>
  
  <p>/etc/apache2/sites-available/FlaskApp.conf :</p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
      ServerName SERVER_IP
      ServerAdmin email@email.com
      WSGIScriptAlias / /var/www/FlaskApp/flaskapp.wsgi
      &lt;Directory /var/www/FlaskApp/FlaskApp/&gt;
          Order allow,deny
          Allow from all
      &lt;/Directory&gt;
      Alias /static /var/www/FlaskApp/FlaskApp/static
      &lt;Directory /var/www/FlaskApp/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>tail -f /var/log/apache2/error.log:
  <a href="https://i.stack.imgur.com/U2ZfA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/U2ZfA.png" alt="error.png"></a></p>