编程语言
首页 > 编程语言> > pythonanywhere flask:网站仅显示“未处理的异常”.如何使调试器打印堆栈跟踪?

pythonanywhere flask:网站仅显示“未处理的异常”.如何使调试器打印堆栈跟踪?

作者:互联网

警告三重新手威胁-python新增,python anywhere新增,flask新增.

[pythonanywhere-root] /mysite/test01.py

# A very simple Flask Hello World app for you to get started with...

from flask import Flask
from flask import render_template # for templating
#from flask import request   # for handling requests eg form post, etc

app = Flask(__name__)
app.debug = True #bshark: turn on debugging, hopefully?

@app.route('/')
#def hello_world():
#    return 'Hello from Flask! wheee!!'
def buildOrg():
    orgname = 'ACME Inc'
    return render_template('index.html', orgname)

然后在[pythonanywhere-root] /templates/index.html中

<!doctype html>
<head><title>Test01 App</title></head>
<body>
{% if orgname %}
  <h1>Welcome to {{ orgname }} Projects!</h1>
{% else %}
<p>Aw, the orgname wasn't passed in successfully :-(</p>
{% endif %}
</body>
</html>

当我访问该网站时,出现“未处理的异常”

标签:flask,pythonanywhere,python
来源: https://codeday.me/bug/20191029/1962172.html