[PYTHON] Flask tutorial (from installation to hello world)

Introduction

A memorandum for doing Hello world in Flask.

Creating a working directory

mkdir flask-tutorial
cd flask-tutorial

Create and activate Python virtual environment

python3 -m venv venv
source venv/bin/activate

Flask installation

pip install flask
pip freeze

Creating the main file

app.py


from flask import Flask
app = Flask(__name__)

@app.route('/')
def hello():
    return 'Hello world'

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

Run

python3 app.py

Recommended Posts

Flask tutorial (from installation to hello world)
RaspberryPi3 (STRETCH) setup from OS installation to Hello World
RabbitMQ Tutorial 1 ("Hello World!")
Hello world with flask
From Kivy environment construction to displaying Hello World
From setting up a Rust environment to running Hello World
From Elasticsearch installation to data entry
Introduction to TensorFlow --Hello World Edition
OpenMPI installation from download to pass-through
Hello World in Flask [Appropriate memo]
Introduction to Ansible Part 1'Hello World !!'
From building a Python environment for inexperienced people to Hello world
Hello world
[Python] Web application from 0! Hands-on (2) -Hello World-
Connect to Docker's MySQL container from Flask
[Note] [PyTorch] From installation to easy usage
How to build Hello, World on #Nix
How to display Hello world in python
Introduction to Scapy ① (From installation to execution of Scapy)
C language to see and remember Part 1 Call C language from Python (hello world)
Re: Heroku life begin with Flask from zero - Environment and Hello world -
[Ansible installation procedure] From installation to execution of playbook
Say hello to the world with Python with IntelliJ
Sum from 1 to 10
Flask Hello World cannot be displayed on VPS
From ROS for Windows installation to operation check
From easy git installation to docker startup python
To myself as a Django beginner (3)-Hello world! ---
cython hello world
Python development environment construction 2020 [From Python installation to poetry introduction]
How to change static directory from default in Flask
Introducing WebPay from Flask
web2py memo: Hello World
Changes from Python 3.0 to Python 3.5
Changes from Python 2 to Python 3.0
Transition from WSL1 to WSL2
Easy to use Flask
hello world with ctypes
Flask Tutorial # 3 ~ DB Linkage ~
Hello, World with Docker
From editing to execution
Django's first Hello World
[CentOS 7.7] From desktop environment installation to remote desktop connection possible (from minimum installation)
Explanation from installation of Sphinx to use of external theme (Bootswatch)
From environment construction to deployment for flask + Heroku with Docker
Until Hello World with Flask + uWSGI + Nginx @ Sakura's VPS (CentOS 6.6)