我創建了這是工作的罰款pythonanywhere燒瓶中的應用程序,但是當我部署它在谷歌應用程序引擎,它給錯誤http://aapkatool.appspot.com/瓶GAE應用程序給錯誤
這裏是我的代碼
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')
這裏是我的app.yaml代碼
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"
這裏是initialize.py代碼
from google.appengine.ext.webapp.util import run_wsgi_app
from main import app
run_wsgi_app(app)
這裏是完整的錯誤
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.
感謝
似乎工作,有什麼錯誤? –
請點擊計算然後它會顯示錯誤錯誤:服務器錯誤 服務器遇到錯誤,無法完成您的請求。 請在30秒後重試。 – user6948460
相同的代碼在http://kk268.pythonanywhere.com/emi-calc上工作正常 – user6948460