title: jinja2.exceptions.UndefinedError: 'function' is undefined
body: <p>I am running a flask server on nginx + uwsgi. When I run just the flask server via <code>python server.py</code>, I am able to use <code>id_encode</code> function in my jinja2 templates, no errors thrown.</p>
  
  <p>However, when I launch (server.py) via </p>
  
  <p><code>uwsgi --socket 0.0.0.0:8002 --module server --callab app</code></p>
  
  <p>It will crash saying that it was unable to find the function <code>id_encode</code>.</p>
  
  <p><code>jinja2.exceptions.UndefinedError: 'id_encode' is undefined</code></p>
  
  <p>Declaring via:</p>
  
  <pre><code>if __name__ == '__main__':
      app.jinja_env.globals.update(id_encode=id_encode)
      app.run(host=host,port=5000, debug=True)
  </code></pre>
  
  <p>What's causing this problem and how can I make the function available?</p>