title: importing from another folder in virtualenv
body: <p>I'm following the <a href="http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world" rel="nofollow">Flask Mega Tutorial</a>, and I'm running into an issue once I get to the second part and restructure my folder structure to match theirs, I cannot import Flask.</p>
  
  <p>My current folder structure is as follows</p>
  
  <pre><code>/FlaskTest
      /app
          /static, templates etc
      /flask
          /virtualenv folders etc
      /tmp
      run.py
  </code></pre>
  
  <p>as far as I can tell, the folder structures are identical other than naming of the top level directory.</p>
  
  <p>in my __init__.py file (/app/__init__.py), I'm doing as instructed in the tutorial, </p>
  
  <pre><code>from flask import Flask
  
  app = Flask(__name__)
  from app import views
  </code></pre>
  
  <p>I'm getting an Import Error that "cannot import name 'Flask'". I'm guessing the issue is because the flask package was installed to /flask/lib/site-packages.</p>
  
  <p>My question: How can I reference the sub folder of flask/site-packages?</p>
  
  <p>I've read through the python  <a href="https://docs.python.org/3/reference/import.html" rel="nofollow">import system documentation</a> and from what I can make of it through the first pass of reading it over, I would need to likely do something like from flask import flask.Flask or something to that effect.</p>
  
  <p><strong>UPDATE</strong>: So after cd'ing around the directory and checking pip list, I realized that flask wasn't accessible to my app directory. I ran pip install flask in the app directory. Now my site runs, but I'm not sure if this is the best practice of doing things with Python. Please provide some clarity as what the best practice is for installing packages and where the packages reside.</p>
  
  <p><strong>UPDATE 2</strong>: After creating a directory called standalone. In this folder, I created a virtual environment called standalone-test. Once, I did that, I also mkdir'ed app and copied it's contents from FlaskTest so that way the code would be identical. I was able to run the run.py script by using <code>python run.py</code>, but I can't run <code>python -m app</code> like you had said without running into an error. The error is as follows if it helps.</p>
  
  <p>"No module name app.<strong>main</strong>; 'app' is a package and cannot be directly executed. </p>
  
  <p>I am able to run <code>python run.py</code> as I mentioned, but I'm not able to run the <code>python -m app</code> command as you had mentioned</p>