title: Flask ImportError: cannot import name app
body: <p>After setting up a simple Flask app from <a href="http://nicolewhite.github.io/neo4j-flask/index.html" rel="noreferrer">this</a> tutorial, with a <code>run.py</code> file containing:
  </p>
  
  <pre><code>from site import app
  import os
  
  app.secret_key = os.urandom(24)
  app.run(debug=True)
  </code></pre>
  
  <p>I have <code>site/__init__.py</code> with</p>
  
  <pre><code>from .views import app
  from .models import graph
  </code></pre>
  
  <p>And under <code>site/views.py</code></p>
  
  <pre><code>from .models import User, get_todays_recent_posts
  from flask import Flask, request, session, redirect, url_for, render_template, flash
  
  app = Flask(__name__)
  </code></pre>
  
  <p>with a bunch of <code>@app.route</code> functions</p>
  
  <p><code>site/models.py</code> has</p>
  
  <pre><code>from py2neo import Graph, Node, Relationship
  from passlib.hash import bcrypt
  from datetime import datetime
  import os
  import uuid
  
  graph = Graph()
  </code></pre>
  
  <p>I keep getting a <code>ImportError: cannot import name app</code> error on the first line of <code>run.py</code>.</p>
  
  <p>All the other questions seem to be a circular import issue, but I'm sure I don't have one. </p>
  
  <p>I haven't created a virtual environment as described in the project, could that be the issue?</p>
  
  <p>I'm using python2.7 on windows.</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>A fix to the problem was to restructure entire project into one .py file, which feels like a cleaner file structure anyway.</p>