title: WHY am I getting this NameError : name 'url_for' is not defined?
body: <p>I am trying to build a URL following the instructions of the flask tutorial </p>
  
  <p><a href="http://flask.pocoo.org/docs/0.11/quickstart/" rel="noreferrer">http://flask.pocoo.org/docs/0.11/quickstart/</a></p>
  
  <p>However I am keeping getting this NameError </p>
  
  <blockquote>
    <p>name 'url_for' is not defined</p>
  </blockquote>
  
  <p>THIS is the code : </p>
  
  <pre><code>from flask import Flask
  
  app = Flask(__name__)
  
  @app.route('/')
  def Index() : pass
  
  @app.route ('/ login')
  def loGin() : pass
  
  @app.route('/user/&lt;username&gt;')
  def profile( username) : pass
  
  
  with app.test_request_context() :
      print url_for('Index')
      print url_for('loGin')
      print url_for('loGin', next='/')
      print url_for('profile', username = 'Jon DD')
  </code></pre>
  
  <p>THIS is the total error message : </p>
  
  <pre><code>eloiim:minimalapp iivri.andre$ export FLASK_APP=Greet.py
  eloiim:minimalapp iivri.andre$ flask run 
  Traceback (most recent call last):
    File "/usr/local/bin/flask", line 11, in &lt;module&gt;
      sys.exit(main())
    File "/usr/local/lib/python2.7/site-packages/flask/cli.py", line 478, in main
      cli.main(args=args, prog_name=name)
    File "/usr/local/lib/python2.7/site-packages/flask/cli.py", line 345, in main
      return AppGroup.main(self, *args, **kwargs)
    File "/usr/local/lib/python2.7/site-packages/click/core.py", line 696, in main
      rv = self.invoke(ctx)
    File "/usr/local/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
      return _process_result(sub_ctx.command.invoke(sub_ctx))
    File "/usr/local/lib/python2.7/site-packages/click/core.py", line 889, in invoke
      return ctx.invoke(self.callback, **ctx.params)
    File "/usr/local/lib/python2.7/site-packages/click/core.py", line 534, in invoke
      return callback(*args, **kwargs)
    File "/usr/local/lib/python2.7/site-packages/click/decorators.py", line 64, in new_func
      return ctx.invoke(f, obj, *args[1:], **kwargs)
    File "/usr/local/lib/python2.7/site-packages/click/core.py", line 534, in invoke
      return callback(*args, **kwargs)
    File "/usr/local/lib/python2.7/site-packages/flask/cli.py", line 388, in run_command
      app = DispatchingApp(info.load_app, use_eager_loading=eager_loading)
    File "/usr/local/lib/python2.7/site-packages/flask/cli.py", line 124, in __init__
      self._load_unlocked()
    File "/usr/local/lib/python2.7/site-packages/flask/cli.py", line 148, in _load_unlocked
      self._app = rv = self.loader()
    File "/usr/local/lib/python2.7/site-packages/flask/cli.py", line 209, in load_app
      rv = locate_app(self.app_import_path)
    File "/usr/local/lib/python2.7/site-packages/flask/cli.py", line 89, in locate_app
      __import__(module)
    File "/Users/iivri.andre/Documents/minimalapp/Greet.py", line 16, in &lt;module&gt;
      print url_for('Index')
  NameError: name 'url_for' is not defined
  </code></pre>
  
  <p>I am not sure what the issue is.</p>