Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
860 views
in Technique[技术] by (71.8m points)

python-3.x - 运行烧瓶应用程序时遇到问题(Having trouble running flask application)

I am new to using Flask.

(我是使用Flask的新手。)

Tried to run the basic flask app but results in neither an error nor any output.

(尝试运行基本的烧瓶应用程序,但不会导致错误或任何输出。)

can anyone help me to resolve the same.

(谁能帮助我解决同样的问题。)

Code: from flask import Flask

(代码:从烧瓶进口烧瓶)

app = Flask( name )

(应用=烧瓶( 名称 ))

@app.route("/") def hello(): return "Hello, World!"

(@ app.route(“ /”)def hello():返回“你好,世界!”)

if name == ' main ': app.run(debug=True, use_reloader=False)

(如果name ==' main ':app.run(debug = True,use_reloader = False))

console:

(安慰:)

  • Serving Flask app " main " (lazy loading)

    (服务Flask应用“ ”(延迟加载))

    • Environment: production WARNING: This is a development server.

      (环境:生产警告:这是开发服务器。)

      Do not use it in a production deployment.

      (不要在生产部署中使用它。)

      Use a production WSGI server instead.

      (请改用生产WSGI服务器。)

    • Debug mode: on

      (调试模式:打开)

I'm not getting *Running on http://127.0.0.1:5000/ (press ctrl+c to quit)

(我没有*正在http://127.0.0.1:5000/上运行(按ctrl + c退出))

can anyone help me on this, Please.

(有人可以帮我吗,请。)

  ask by Ann Mary translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
app = Flask(__name__) 

You forgot the underscores.

(您忘记了下划线。)

if __name__ == '__main__':
app.run()

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...