title: Why os.path.join(app.root_path, 'flaskr.db')?
body: <p>In this link <a href="http://flask.pocoo.org/docs/0.12/tutorial/setup/#tutorial-setup" rel="nofollow noreferrer">http://flask.pocoo.org/docs/0.12/tutorial/setup/#tutorial-setup</a> </p>
  
  <p><strong>In file in flaskr.py :</strong></p>
  
  <pre><code>app = Flask(__name__) # create the application instance :)
  app.config.from_object(__name__) # load config from this file , flaskr.py
  
  # Load default config and override config from an environment variable
  app.config.update(dict(
    DATABASE=os.path.join(app.root_path, 'flaskr.db'),
    SECRET_KEY='development key',
    USERNAME='admin',
    PASSWORD='default'
  ))
  app.config.from_envvar('FLASKR_SETTINGS', silent=True)
  </code></pre>
  
  <p><strong>The explanation for the line</strong> </p>
  
  <pre><code>DATABASE=os.path.join(app.root_path, 'flaskr.db'),
  </code></pre>
  
  <p><strong>is :</strong> </p>
  
  <p>Operating systems know the concept of a current working directory for each process. Unfortunately, you cannot depend on this in web applications because you might have more than one application in the same process.</p>
  
  <p>For this reason the app.root_path attribute can be used to get the path to the application. Together with the os.path module, files can then easily be found. In this example, we place the database right next to it.</p>
  
  <p><strong>Can anyone explain it with example as I am unable to understand the explanation?</strong></p>