Getting Started with Flask (for Absolute Beginners)


Are you new to web development with Python? Want to build a simple website or app? Flask is a great place to start! This guide will walk you through everything step by step—no complicated setup, just pure simplicity.


💡 What is Flask?

Flask is a tool that helps you build websites and web apps using Python. It’s:

  • Simple to use
  • Lightweight
  • Great for learning how web apps work

✅ What You Need

Make sure you have the following:

  • Python installed (version 3.7 or higher)

🔹 Step 1: Install Flask

Let’s install Flask using a command.

  1. Open the Command Prompt (Windows) or Terminal (Mac/Linux)
  2. Type this and press Enter:
pip install flask

This will download and install Flask on your computer.

💡 Tip: If pip doesn’t work, try python -m pip install flask


🔹 Step 2: Create Your First Flask App

Now let’s build your first Flask website.

  1. Open any folder (like Documents) and create a new folder called flask_app
  2. Open Notepad (or any text editor like VS Code)
  3. Copy this code and save it as app.py inside the flask_app folder:
from flask import Flask

app = Flask(__name__)

@app.route('/')
def home():
    return 'Hello, Flask!'

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

🔹 Step 3: Run the App

Now let’s run the app!

  1. Open Command Prompt (Windows) or Terminal (Mac/Linux)
  2. Navigate to the folder where your app.py is. Example:
cd Desktop\flask_app

(Or wherever you saved the file)

  1. Run the app:
python app.py

If everything is okay, you’ll see something like this:

 * Running on http://127.0.0.1:5000/
  1. Open your browser and go to http://127.0.0.1:5000/
    You’ll see Hello, Flask! 🎉

🧪 Step 4: Try More Routes

Want to add more pages?

Open app.py and add these lines:

@app.route('/about')
def about():
    return 'This is the About page'

@app.route('/hello/<name>')
def greet(name):
    return f'Hello, {name}!'

Save the file and restart your app (press Ctrl+C, then run python app.py again). Now try:


🎯 What’s Next?

You’ve just built your first Flask app! From here, you can:

  • Add HTML pages
  • Accept form inputs
  • Connect to a database
  • Build real apps like a blog or a to-do list

📚 Resources to Keep Learning


🙌 Final Words

Flask makes it easy to turn your Python code into a working website. Don’t worry about doing everything perfectly—just keep experimenting and building!

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top