I tried to run a flame application in CentOS7.2 (Vagrant) environment, but the following error occurred. I'm in trouble because I don't know how to deal with it.

[vagrant @ localhost app] $python app.py
Traceback (most recent call last):
  File "app.py", line 4, in<module>
    app.run ()
AttributeError: 'Blueprint' object has no attribute 'run'

I would appreciate it if you could teach me.

  • Answer # 1


    There is no run method for objects instantiated from the Blueprint class.

    app = Blueprint ()
    app.run () #<--- This is not possible.

    Execute the run method from an object instantiated from the Flask class.

    from flask import Flask, escape, request
    app = Flask (__ name__)
    @ app.route ('/')
    def hello ():
        name = request.args.get ("name", "World")
        return f'Hello, {escape (name)}! '
    app.run ()