Hello world with flask

Target

Just display "** Hello, world! **" in your browser. fisrst-flask.png

environment

Directory structure

only this. tree.png

Source code

For ʻindex.html, just type! In Emmet on VS Code and write

Hello, world! </ H1> `in the expanded tab.

<!DOCTYPE html>
<html lang="ja">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <h1>Hello, world!</h1>
</body>
</html>

There is no particular reason to set port = '5555' in sample.py.

from flask import Flask, render_template

#Instantiation
app = Flask(__name__)

@app.route('/')
def index():
    return render_template('index.html');

if __name__ == '__main__':
    app.run(host='0.0.0.0', port='5555', debug=True)

Start-up

>python sample.py

Recommended Posts

Hello world with flask
Hello World with Flask + Hamlish
hello world with ctypes
Hello, World with Docker
Draw hello world with mod_wsgi
Until hello world with zappa
Hello world
Hello, world! With virtual CAN communication
[Note] Hello world output with python
Hello World in Flask [Appropriate memo]
Hello World! By QPython with Braincrash
Pymacs hello world
Until Hello World with Flask + uWSGI + Nginx @ Sakura's VPS (CentOS 6.6)
cython hello world
Hello World and face detection with opencv-python 4.2
Hello World with Raspberry Pi + Minecraft Pi Edition
Flask tutorial (from installation to hello world)
Hello World! By QPython with Brainfu * k
Hello World and face detection with OpenCV 4.3 + Python
Hello World with gRPC / go in Docker environment
web2py memo: Hello World
Hello world with full features of Go language
RabbitMQ Tutorial 1 ("Hello World!")
Say hello to the world with Python with IntelliJ
Hello World with nginx + uwsgi + python on EC2
Flask Hello World cannot be displayed on VPS
IP restrictions with Flask
Re: Heroku life begin with Flask from zero - Environment and Hello world -
Hello World on Django
First python ① Environment construction with pythonbrew & Hello World !!
Django's first Hello World
Create a "Hello World" (HTTP) server with Tornado
Programming with Python Flask
Predicting Kaggle's Hello World, Titanic Survivors with Logistic Regression-Modeling-
Deploy Flask with ZEIT Now
Touch Flask + run with Heroku
Unit test flask with pytest
API with Flask + uWSGI + Nginx
SNS Flask (Ajax) made with Flask
Web application development with Flask
Programming language in "Hello World"
Hello World in GO language
View flask coverage with pytest-cov
Web application with Python + Flask ② ③
File upload with Flask + jQuery
Hello World (beginners) on Django
Web application with Python + Flask ④
Hello World with Google App Engine (Java 8) + Servlet API 3.1 + Gradle
Predicting Kaggle's Hello World, Titanic Survivors with Logistic Regression-Prediction / Evaluation-
Hello World with Google App Engine (Java 11) + Spring Boot + Gradle
SNS Flask (Model) edition made with Flask
[LINE login] Verify state with Flask
Getting Started with Heroku-Viewing Hello World in Python Django with Raspberry PI 3
Let's do "Hello World" in 40 languages! !!
SNS Python basics made with Flask
[Memo] Links for developing with Flask
Start with Windows, not so scary Nim ① It's like hello world.
Introduction to TensorFlow --Hello World Edition
Hello world! (Minimum Viable Block Chain)
Creating a Flask server with Docker
Python beginners tried Hello World in 30 seconds using the micro-framework Flask