2021年4月11日星期日

What is the SyntaxError here in return 'Hello world' when I try to launch my Flask application?

I am a beginner at Flask and this is my first time trying to run a Flask application. My hello.py code is:

from flask import Flask  app = Flask(__name__)  @app.route('/')  def index:      return '<h1>Hello world</h1>'  

And after running the program on CMD using the command python -m flask run

I got this error

SyntaxError  File "C:\Users\91932\OneDrive\Desktop\Projects\Personal Projects\FLASK Projects\Test\hello.py", line 4      def index:               ^  SyntaxError: invalid syntax  

What should I do? Please help.

https://stackoverflow.com/questions/67051539/what-is-the-syntaxerror-here-in-return-h1hello-world-h1-when-i-try-to-laun April 12, 2021 at 09:04AM

没有评论:

发表评论