--Creating a simple app with flask ← ★ Currently here -Try to create a Home screen -Try to create an authentication function -Try to handle the database -Try to create CRUD function
Flask is a Python micro-framework developed in 2010. It is called a "micro-framework" because it relies on the minimum required libraries and does not require any specific tools or libraries.
Flask was created with the motivation to be a "single file framework". It also has the greatness of being customizable to any application since it was a minimal yesterday.
We recommend that you do it in a virtual environment.
app/
├ src/
├ templates
├ static
├ manage.py
├ requirements.txt
├ venv
├ server.py
from flask import Flask
app = Flask(__name__)
import src.views
from src import app
@app.route('/')
def index():
return "Hello World"
import sys
sys.dont_write_bytecode = True
from src import app
if __name__ == '__main__':
host = '127.0.0.1'
port = 5000
app.run(host=host, port=port, debug=True)
This file describes what happens when a request is met at http://127.0.0.1:5000/. *'if name =='main':' describes what happens when this file is run directly. *'Debug = True' launches the application in debug mode and runs it to display various information on the console when the app is run.
$ python3 serve.py
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
Recommended Posts