2
我試圖運行Gunicorn的燒瓶應用程序。當我運行gunicorn app:index
時,出現錯誤TypeError: index() takes 0 positional arguments but 2 were given
。我見過的例子都沒有顯示index
需要兩個參數。這個錯誤是什麼意思?如何與Gunicorn運行Flask?Gunicorn運行燒瓶引發TypeError:index()需要0個位置參數,但給出了2個
from flask import Flask
app = Flask(__name__)
@app.route("/")
def index():
return 'Hello, World!'
gunicorn app:index
respiter = self.wsgi(environ, resp.start_response)
TypeError: index() takes 0 positional arguments but 2 were given
我改變index
取兩個參數,卻得到了不同的錯誤。
@app.route("/")
def index(arg1, arg2):
return 'Hello, World!'
/python3.4/site-packages/flask/templating.py, line 132, in render_template
ctx.app.update_template_context(context)
AttributeError: 'NoneType' object has no attribute 'app'