Overview:
Flask is a lightweight WEB application framework written using Python. Its WSGI Toolbox uses Werkzeug, and the template engine uses JINJA2 (similar to Smarty in PHP, designed to allow the program to interface with data). Flask uses BSD authorization.
WSGI (Python Web server Gateway Interface) is an interface between a Python application or framework and a WEB server that has been widely accepted. Similar to the Servelet API in Java.
Installation steps:
1. Install Pip
Execute distribute_setup.py, there will be easy_install under Python's scripts, use this script to install PIP
Easy_install pip
2. Install Virtualenv
Virtualenv can create a Python virtual environment in which the environment between different projects can be mutually exclusive. Detailed Introduction View: http://www.cnblogs.com/harrychinese/archive/2012/01/09/use_virtualenv_on_windows.html
Pip Install "Virtualenv < 1.11"
Install the version before 1.11, otherwise there will be a bug.
3. Create a virtual environment
Create a new project directory to execute under the new directory:
Virtualenv my_project
or
python-m virtualenv my_project
When the above command is completed, a new directory My_project is created, along with a new Python development environment. Then install the flask to My_project:
Pip Install flask
Several problems encountered during the erection process:
Http://askubuntu.com/questions/400343/trying-to-create-a-python-virtual-environment-but-getting-oserror
Http://stackoverflow.com/questions/23523812/fatal-error-when-using-scripts-through-virtualenv-extra-quotes-around-python-e
Http://stackoverflow.com/questions/20925329/trouble-with-creating-a-virtual-environment-in-windows-8-python-3-3
4. Switch environment
After you create a virtual environment for your project using VIRTUALENV, you need to activate this environment before you can run this project
Venv\scripts\activate
Venv is the project name