The easiest way to make Flask

This is the easiest way to create a Flask app. When you access http: // localhost: 3000 / hello with a web browser, the save dialog of the json file (content is {'result':'hello world!'}) Is displayed.

installing flask


pip install flask

hello.py


# -*- coding: utf-8 -*-
from flask import Flask, make_response, jsonify

# flask
app = Flask(__name__)

# rest api
@app.route('/hello', methods=['GET'])
def hello_world():
    return make_response(jsonify({'result':'hello world!'}))
    
# main
if __name__ == "__main__":
    app.run(host='localhost', port=3000)

Recommended Posts

The easiest way to make Flask
The easiest way to set up Last-Modified in Flask
The easiest way to try PyQtGraph
The easiest way to get started with Django
The easiest way to synthesize speech with python
The easiest way to use OpenCV with python
Probably the easiest way to create a pdf with Python3
The fastest way to try EfficientNet
The easiest way to get started in Slack socket mode (Go)
The easiest way to get Chainer v1.5 + CUDA + cuDNN on Windows
The fastest way for beginners to master Python
Excel X Python The fastest way to work
Introduction to Python with Atom (on the way)
Day 66 [Introduction to Kaggle] The easiest Titanic forecast
Easy way to check the source of Python modules
Make the tool simply
Easy to use Flask
Try to make RESTful API with MVC using Flask 1.0.2
Explaining how to make LINE BOT in the world's easiest way (2) [Preparing a bot application in a local environment with Django in Python]
The road to Pythonista
The easiest line bot in the world to lose weight
The road to Djangoist
Deploy the management page to production to make maintenance easier.
How to make a Cisco Webex Teams BOT with Flask
Make the display of Python module exceptions easier to understand
The first API to make with python Djnago REST framework
You who color the log to make it easier to see
How to deploy the easiest python textbook pybot on Heroku
Put the lists together in pandas to make a DataFrame
Django Make choices only for the facility you belong to
The usual way to add a Kernel with Jupyter Notebook
I want to make the Dictionary type in the List unique
Flask Web server cannot be published to the outside [VScode]
How to use the generator
Dot according to the image
The road to download Matplotlib
Hypothesis / Verification (176) How to make a textbook that is easier than "The easiest textbook for quantum computers"
Easy to make with syntax
[Python] Another way to import
Easy way to rename files
React and Flask to GCP
How to use the decorator
How to increase the axis
How to start the program
An easy way to hit the Amazon Product API in Python
To make sure that the specified key is in the specified bucket in Boto 3
Easy way to round off to the nearest whole number with python3
Make the theme of Pythonista 3 like Monokai (how to make your own theme)
How to make a command to read the configuration file with pyramid
The simplest way to build a Spleeter usage environment using Windows
The most polite way to use the Google Maps SDK for iOS
[Numpy] Probably the shortest way to alternately synthesize two one-dimensional arrays
I want to make the second line the column name in pandas
The road to installing Python and Flask on an offline PC
The road to web application development is a long way off
The fastest way to get camera images regularly with python opencv
How to display bytes in the same way in Java and Python
What is Jenkins? ] Installation-how to use-automatic test / automatic deployment will be explained in the world's easiest way