docs: Improve Quickstart example clarity for beginners
- Added explicit file naming instructions - Enhanced code comments for better understanding - Included if __name__ == '__main__' pattern - Clarified where to save the application file
This commit is contained in:
parent
88a65bb374
commit
4c0afe65d9
1 changed files with 12 additions and 6 deletions
|
|
@ -6,19 +6,25 @@ Follow :doc:`installation` to set up a project and install Flask first.
|
||||||
|
|
||||||
|
|
||||||
A Minimal Application
|
A Minimal Application
|
||||||
---------------------
|
=====================
|
||||||
|
|
||||||
A minimal Flask application looks something like this:
|
A minimal Flask application looks something like this.
|
||||||
|
|
||||||
.. code-block:: python
|
Save this code in a file named ``app.py``::
|
||||||
|
|
||||||
from flask import Flask
|
from flask import Flask
|
||||||
|
|
||||||
|
# Create a Flask application instance
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
@app.route("/")
|
@app.route('/')
|
||||||
def hello_world():
|
def hello():
|
||||||
return "<p>Hello, World!</p>"
|
return 'Hello, World!'
|
||||||
|
|
||||||
|
# Run the application
|
||||||
|
if __name__ == '__main__':
|
||||||
|
app.run(debug=True)
|
||||||
|
|
||||||
|
|
||||||
So what did that code do?
|
So what did that code do?
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue