Flask GAE app giving error
<p>I created a flask app which is working fine on pythonanywhere but when i deployed it on google app engine ,its giving error <a href="http://aapkatool.appspot.com/" rel="nofollow">http://aapkatool.appspot.com/</a></p>

<p>here is my code</p>

<pre><code>from flask import Flask, request, session, redirect,url_for,render_template,flash,abort
import jinja2
import os
jinja_environment = jinja2.Environment(autoescape=True,
    loader=jinja2.FileSystemLoader(os.path.join(os.path.dirname(__file__), 'templates')))

app = Flask(__name__)
app.config["DEBUG"] = True
@app.route('/', methods=['POST', 'GET'])
def emi():
  if request.method == 'POST':

    p =int(request.form['enternumber1'])
    r=float(request.form['enternumber2'])
    R=(r/12)/100
    N =int(request.form['enternumber3'])
    Dp =int(request.form['enternumber4'])
    P=p-Dp
    B=(1+R)**N
    I=(B)/(B-1)

    EMI1 = (P) * (R) * (I)
    EMI="%.2f" %(EMI1)
    TAP1=EMI1*N
    TAP="%.2f" %(TAP1)
    TI=TAP1-P
    TI="%.2f" %(TI)



    return render_template('index.html', EMI=EMI,TAP=TAP,TI=TI,P=P,r=r,N=N,Dp=Dp)
  return render_template('index.html')
</code></pre>

<p>and here is my app.yaml code</p>

<pre><code>application: aapkatool
version: 1
runtime: python27
api_version: 1
threadsafe: yes

handlers:
- url: /.*
  script: initialize.app

libraries:
- name: jinja2
  version: "2.6"

- name: markupsafe
  version: "latest"
</code></pre>

<p>and here is initialize.py code</p>

<pre><code>from google.appengine.ext.webapp.util import run_wsgi_app

from main import app

run_wsgi_app(app)
</code></pre>

<p>here is the complete error</p>

<pre><code>Traceback (most recent call last):

  File "C:\Program Files\Google\google_appengine\google\appengine\runtime\wsgi.py", line 267, in Handle

    result = handler(dict(self._environ), self._StartResponse)

  File "C:\Python27\ageapp\flask\app.py", line 1701, in __call__

    return self.wsgi_app(environ, start_response)

  File "C:\Python27\ageapp\flask\app.py", line 1685, in wsgi_app

    with self.request_context(environ):

  File "C:\Python27\ageapp\flask\app.py", line 1646, in request_context

    return RequestContext(self, environ)

  File "C:\Python27\ageapp\flask\ctx.py", line 186, in __init__

    self.match_request()

  File "C:\Python27\ageapp\flask\ctx.py", line 204, in match_request

    self.url_adapter.match(return_rule=True)

  File "C:\Python27\ageapp\werkzeug\werkzeug\routing.py", line 1423, in match

    raise NotFound()

NotFound: 404: Not Found

INFO     2016-10-12 15:13:03,801 module.py:788] default: "GET /favicon.ico HTTP/1.1" 500 -
ERROR    2016-10-12 09:43:46,542 wsgi.py:279] 

Traceback (most recent call last):

  File "C:\Program Files\Google\google_appengine\google\appengine\runtime\wsgi.py", line 267, in Handle

    result = handler(dict(self._environ), self._StartResponse)

  File "C:\Python27\ageapp\flask\app.py", line 1701, in __call__

    return self.wsgi_app(environ, start_response)

  File "C:\Python27\ageapp\flask\app.py", line 1689, in wsgi_app

    response = self.make_response(self.handle_exception(e))

  File "C:\Python27\ageapp\flask\app.py", line 1687, in wsgi_app

    response = self.full_dispatch_request()

  File "C:\Python27\ageapp\flask\app.py", line 1360, in full_dispatch_request

    rv = self.handle_user_exception(e)

  File "C:\Python27\ageapp\flask\app.py", line 1358, in full_dispatch_request

    rv = self.dispatch_request()

  File "C:\Python27\ageapp\flask\app.py", line 1344, in dispatch_request

    return self.view_functions[rule.endpoint](**req.view_args)

  File "C:\Python27\ageapp\main.py", line 13, in age2

    p =int(request.form['enternumber1'])

  File "C:\Python27\ageapp\werkzeug\werkzeug\local.py", line 336, in __getattr__

    return getattr(self._get_current_object(), name)

  File "C:\Python27\ageapp\werkzeug\werkzeug\utils.py", line 77, in __get__

    value = self.func(obj)

  File "C:\Python27\ageapp\werkzeug\werkzeug\wrappers.py", line 383, in form

    self._load_form_data()

  File "C:\Python27\ageapp\flask\wrappers.py", line 129, in _load_form_data

    RequestBase._load_form_data(self)

  File "C:\Python27\ageapp\werkzeug\werkzeug\wrappers.py", line 318, in _load_form_data

    data = parser.parse_from_environ(self.environ)

  File "C:\Python27\ageapp\werkzeug\werkzeug\formparser.py", line 164, in parse_from_environ

    return self.parse(stream, mimetype, content_length, options)

  File "C:\Python27\ageapp\werkzeug\werkzeug\formparser.py", line 188, in parse

    content_length, options)

  File "C:\Python27\ageapp\werkzeug\werkzeug\formparser.py", line 98, in wrapper

    return f(self, stream, *args, **kwargs)

  File "C:\Python27\ageapp\werkzeug\werkzeug\formparser.py", line 209, in _parse_urlencoded

    errors=self.errors, cls=self.cls)

  File "C:\Python27\ageapp\werkzeug\werkzeug\urls.py", line 278, in url_decode_stream

    include_empty, errors))

  File "C:\Python27\ageapp\werkzeug\werkzeug\datastructures.py", line 330, in __init__

    for key, value in mapping or ():

  File "C:\Python27\ageapp\werkzeug\werkzeug\urls.py", line 283, in _url_decode_impl

    for pair in pair_iter:

  File "C:\Python27\ageapp\werkzeug\werkzeug\wsgi.py", line 670, in make_chunk_iter

    stream = make_limited_stream(stream, limit)

  File "C:\Python27\ageapp\werkzeug\werkzeug\wsgi.py", line 579, in make_limited_stream

    raise TypeError('stream not limited and no limit provided.')

TypeError: stream not limited and no limit provided.

INFO     2016-10-12 15:13:46,665 module.py:788] default: "POST / HTTP/1.1" 500 -

please help me why it is giving error.
</code></pre>

<p>Thanks</p>

<p>Is the <code>calculate</code> function defined in both deployments on <a href="http://kk268.pythonanywhere.com/emi-calc" rel="nofollow">http://kk268.pythonanywhere.com/emi-calc</a> and <a href="http://aapkatool.appspot.com/" rel="nofollow">http://aapkatool.appspot.com/</a> ? The only error I'm seeing in my browser is:</p>

<pre><code>(index):145 Uncaught ReferenceError: calculate is not defined
onclick @ (index):145
</code></pre>

<p>and I don't see where the <code>calculate</code> function is defined.</p>

python google-app-engine flask jinja2