title: flask : how to architect the project with multiple apps?
body: <p>Lets say I want to build a project Facebook</p>
  
  <p>I need a project structure like  </p>
  
  <pre><code>facebook/
           __init__.py
           feed/
               __init__.py
               models.py
               business.py
               views.py
           chat/
               __init__.py
               models.py
               business.py
               views.py
           games/
               __init__.py
               models.py
               business.py
               views.py
           common/
               common.py
  
           runserver.py
  </code></pre>
  
  <p>How can I structure this well so that when I run</p>
  
  <pre><code>python facebook/runserver.py
  </code></pre>
  
  <p>It loads views from all my apps internally?<br>
  I want to keep this structure because extending the project further is more natural way</p>
  
  <p>I am trying to follow their <a href="http://flask.pocoo.org/docs/patterns/packages/">advice</a>, but don't really understand where I need to write  </p>
  
  <pre><code>from flask import Flask
  
  app = Flask(__name__)
  </code></pre>
  
  <p>and how to import all views from all apps at one place, please help</p>
  
  <p>If lets say I write the above code in <code>facebook/__init__.py</code>, then how in <code>facebook/feed/views.py</code>, I can do</p>
  
  <pre><code>from facebook import app
  </code></pre>