title: Structuring Flask using Blueprints error
body: <p>I'm attempting to break a small app into units and use the Blueprint pattern in Flask. However I seem to have trouble in getting the app running.</p>
  
  <p>Here is my structure:</p>
  
  <pre><code>\myapp
    login.py
    \upload
      __init__.py
      views.py  
  </code></pre>
  
  <p>Here is login.py:</p>
  
  <pre><code>import sys, os
  from flask import Flask, Blueprint, request
  from flask import render_template, session
  from .upload import views
  
  
  app = Flask(__name__)
  app.register_blueprint(views)
  
  @app.route('/')
  def index():
      return render_template('index.html')
  
  if __name__ == '__main__':  
      print app.url_map
      print app.blueprints
      app.run(debug = True)
  </code></pre>
  
  <p>for <code>__init__.py</code></p>
  
  <pre><code>    from flask import Flask
      app.register_blueprint('upload', __name__)
  </code></pre>
  
  <p>and in views.py</p>
  
  <pre><code>from flask import Flask, Blueprint, request, redirect, url_for, render_template
  import views
  
  upload = Blueprint('upload', __name__)
  
  @upload.route('/uploaded', methods=['GET', 'POST'])
  def upload_file():
      ...
  </code></pre>
  
  <p>Looking at the logs on heroku, here is the error:</p>
  
  <pre><code>from .upload import views
  2015-09-05T10:59:00.506513+00:00 app[web.1]: ValueError: Attempted relative import in non-package
  </code></pre>
  
  <p>Have a structured my package and blueprint correctly? I used the documentation, but I think I'm missing something here.</p>