我故意在app = Flask(name)中删除了名字,我收到此错误:
Traceback (most recent call last):
File "routes.py", line 4, in <module>
app = Flask()
TypeError: __init__() takes at least 2 arguments (1 given)
Run Code Online (Sandbox Code Playgroud)
这是我的nettuts代码,这是我的代码:
from flask import Flask, render_template
app = Flask()
@app.route('/')
def home():
return render_template('home.html')
@app.route('/about')
def about():
return render_template('about.html')
if __name__ == '__main__':
app.run(debug=True)
Run Code Online (Sandbox Code Playgroud)
我的问题是:这个init方法在哪里至少需要2个参数?
在第2步:应用程序设置代码的烧瓶教程中,我想使用mysql而不是sqlite3.我只是这样做:
# all the imports
import mysql
Run Code Online (Sandbox Code Playgroud)