PIP install Virtualenv Install virtualenv on the system

mkdir myproject cd myproject virtualenv venv

Venv \scripts\ Activate Activate virtual environment (Windows)

(venv) $ pip install flask

flask\Scripts\pip install flask flask\Scripts\pip install flask-login flask\Scripts\pip install flask-openid flask\Scripts\pip install flask-mail flask\Scripts\pip install flask-sqlalchemy flask\Scripts\pip install sqlalchemy-migrate flask\Scripts\pip install flask-whooshalchemy flask\Scripts\pip install flask-wtf flask\Scripts\pip install flask-babel flask\Scripts\pip install guess_language flask\Scripts\pip install flipflop flask\Scripts\pip install coverage

F:\flask>venv\scripts\activate

(venv) F:\flask>mkdir app

(venv) F:\flask>mkdir app\static

(venv) F:\flask>mkdir app\templates

(venv) F:\flask>mkdir tmp


Create F: \ flask \ app_init_ py * * * *

From flask import flask # create an app,__name__ is a python pre-defined variable that is set to use this module. App = flask (name) # So I don’t want to come back to it later, so I put from app import views first


F:\flask\app\views.py # import a route from the app module (__init__. Py). @app.route(‘/’) @app.route(‘/index’) def index(): return “Hello,World!”


F:\flask\run.py

# Import app from app module

If name==’main’: app.run()


flask
Copy the code

├── ├─ ├─ ├─ ├─ ├─ ├─ ├─

Flask run F:\flask> Flask run

  • Environment: production WARNING: Do not use the development server in a production environment. Use a production WSGI server instead.
  • Debug mode: off
  • Running on http://127.0.0.1:5000/ (Press CTRL+C to quit) 127.0.0.1 – – [08/Aug/2018 19:54:11] “GET/HTTP/1.1” 200 –

Hello World is displayed successfully