Professional Documents
Culture Documents
Simple Flask App
Simple Flask App
Simple Flask App
C:\Windows\System32>cd flask_project
C:\Windows\System32\flask_project>install pip
Python was not found; run without arguments to install from the Microsoft Store, or disable this
shortcut from Settings > Manage App Execution Aliases.
ERROR: You must give at least one requirement to install (see "pip help install")
Collecting pip
Uninstalling pip-22.2.2:
Successfully uninstalled pip-22.2.2
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-
script-location.
C:\Windows\System32\flask_project>.\env\Scripts\activate
C:\Windows\System32\flask_project\env\Scripts\python.exe
C:\Users\lenovo\AppData\Local\Microsoft\WindowsApps\python.exe
Collecting flask
Collecting Werkzeug>=2.2.2
Collecting itsdangerous>=2.0
Collecting click>=8.0
Collecting colorama
Collecting MarkupSafe>=2.0
Installing collected packages: MarkupSafe, itsdangerous, colorama, Werkzeug, Jinja2, click, flask
(env) C:\Windows\System32\flask_project>code .
(env) C:\Windows\System32\flask_project>python>back.py
Python 3.10.7 (tags/v3.10.7:6cc6b13, Sep 5 2022, 14:08:36) [MSC v.1933 64 bit (AMD64)] on win32
>>> exit()
WARNING: This is a development server. Do not use it in a production deployment. Use a production
WSGI server instead.
* Running on http://127.0.0.1:5000
(env) C:\Windows\System32\flask_project>
app = Flask(__name__)
@app.route('/welcome')
def home():
return"Welcome to Masai"
from flask import Flask
@app.route('/about-me')
def home():
return jsonify({'name':'Bob',
'age':'25',
'height':'5.10',
'gender':'M'})
@app.route('/score_in_last_3_evals')
def print_list():
return jsonify(list(range(3)))