Loading

Quipoin Menu

Learn • Practice • Grow

python / Flask Basics
tutorial

Flask Basics

Flask is a lightweight web framework for building web applications and APIs. It is minimalistic but extensible, making it perfect for small projects and microservices.

Installation
`pip install flask`

Hello World App
Create a `app.py` file.


from flask import Flask

app = Flask(__name__)

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

if __name__ == "__main__":
app.run(debug=True)

Routes and Variables
Capture URL variables.


@app.route('/user/')
def user(name):
return f"Hello, {name}!"

HTTP Methods
Specify methods for a route.


@app.route('/submit', methods=['POST'])
def submit():
data = request.json
return {"received": data}

Templates (Jinja2)
Return HTML templates with variables.


from flask import render_template

@app.route('/hello/')
def hello_name(name):
return render_template("hello.html", name=name)
Flask is a great starting point for learning web development with Python.
Two Minute Drill
  • Flask is a micro‑web framework.
  • Define routes with `@app.route`.
  • Return strings, JSON, or render templates.
  • Use `request` to access incoming data.
  • Run with `python app.py`.

Need more clarification?

Drop us an email at career@quipoinfotech.com