当我试图运行一个小脚本时,它显示“无法找到记录器处理程序”方案指南“”

时间:2018-03-07 05:40:03

标签: flask flask-ask

当我尝试执行给定的代码时,我得到了没有处理程序可用于记录器“方案指南”。我不知道使用什么处理程序可以帮助我吗?

import inspect
import os
from flask import Flask,render_template
from flask_ask import Ask, statement, question,request
from afg import Supervisor

app = Flask(__name__)
ask = Ask(app, "/")
sup = Supervisor('scenario.yaml')

class check:
    @ask.launch
    @sup.guide
    def launched():
      return question(render_template('welcome'))

    @ask.intent('firstIntent')
    @sup.guide
    def choose_first():
      return question(render_template('first'))

    @ask.intent('secondIntent')
    @sup.guide
    def choose_second():
      return question(render_template('second'))

    @ask.intent('thirdIntent')
    @sup.guide
    def choose_third():
      return statement(render_template('third'))

    @ask.intent('byeIntent')
    @sup.guide
    def choose_bye():
      pass

    if __name__ == "__main__":
      app.run(debug=True)

1 个答案:

答案 0 :(得分:0)

从代码中删除class check:,您就可以运行该脚本了。

import inspect
import os
from flask import Flask,render_template
from flask_ask import Ask, statement, question,request
from afg import Supervisor

app = Flask(__name__)
ask = Ask(app, "/")
sup = Supervisor('scenario.yaml')

@ask.launch
@sup.guide
def launched():
    return question(render_template('welcome'))

@ask.intent('firstIntent')
@sup.guide
def choose_first():
    return question(render_template('first'))

@ask.intent('secondIntent')
@sup.guide
def choose_second():
    return question(render_template('second'))

@ask.intent('thirdIntent')
@sup.guide
def choose_third():
    return statement(render_template('third'))

@ask.intent('byeIntent')
@sup.guide
def choose_bye():
    pass

if __name__ == "__main__":
    app.run(debug=True)

另外,如果您希望在烧瓶服务器中创建基于类的视图,请参阅this。 希望这会对你有所帮助。