pip install flask
from flask import Flask
app = Flask(__name__)
# Command line starts with the manager, access will become very slow
pip install flask_script
from flask_script import Manager
manager = Manager(app)
# Database migration
pip install flask_migrate
from flask_migrate import Migrate,MigrateCommand
migrate = Migrate (app, db) # db is SQLAlchemy () Object
manager.add_command(“db”,MigrateCommand)
__init__.py
from flask improt Blueprint
index_blu = Blueprint(“index”,__name__)
from . import view
view.py
from . import index_blu
@index_blu.route(“/”)
def index():
return “hello” # {“msg”:1},jsonify(),redirct(“/news”),redirect(url_for(“index”)),render_template(“news/1.html”,data=data),make_response()
if __name__ == “__main__”:
manager.run(debug=True,host=”127.0.0.1:5000”)