Flask is a lightweight WEB application framework written using Python. Its WSGI Toolbox uses Werkzeug, and the template engine uses JINJA2. Many implementations of functionality refer to the Django framework. As a result of the project needs, this record of learning process and experience.
工欲善其事, its prerequisite. Start with a set of flask development environment to begin FLASK Tour.
First, platform description
Operating system: Window 7 64bit database: mysql5.6 python:v2.7 Development Integration software: PyCharm5.0
Second, the development of the environment to build
1. Install Flask Frame Package
1), open the command line for Windows:pip install flask
E:\workdir\blog2>pip Install flask
Requirement already satisfied:flask in C:\python27\lib\site-packages
Requirement already satisfied:jinja2>=2.4 in c:\python27\lib\site-packages (from flask)
Requirement already satisfied:werkzeug>=0.7 in c:\python27\lib\site-packages (from flask)
Requirement already satisfied:click>=2.0 in c:\python27\lib\site-packages (from flask)
Requirement already satisfied:itsdangerous>=0.21 in c:\python27\lib\site-packages (from flask)
Requirement already satisfied:markupsafe in C:\python27\lib\site-packages (from Jinja2>=2.4->flask)
2), verify that the installation is successful
E:\workdir\blog2>python
python 2.7.10 (default, May 2015, 09:44:00) [MSC v.1500-bit (AMD64)] on WI
n32
type "Help", "copyright", "credits" or "license" for the more information.
>>>
>>>
>>> from flask import Flask
>>>
When the import flask package does not have any errors, it means that the flask has been installed successfully.
2. Install Flask-sqlalchemy Package
Flask-sqlalchemy, what is this stuff? Let's start with SQLAlchemy, SQLAlchemy is an open-source software in the Python programming language. With SQL Toolkit and object-relational mapping (ORM) tools, Sqlalchmey uses a data mapping model similar to that in Java hibernate, which is one of the most widely used ORM tools in the Python community, no less than the Django ORM Framework, after release 2006.
The Flask-sqlalchemy package is an extension that adds SQLAlchemy support for flask applications. It requires a version of SQLAlchemy 0.6 or higher. It is dedicated to simplifying the use of SQLAlchemy in flask, providing useful defaults and additional assistants to more easily accomplish common tasks.
1, first to install SQLAlchemy, open the Windows command line:pip install sqlalchemy
E:\workdir\blog2>pip Install SQLAlchemy
2), and then install Flask-sqlalchemy
E:\workdir\blog2>pip Install Flask-sqlalchemy
3), verify Flask-sqlalchemy is installed successfully
E:\workdir\blog2>python
python 2.7.10 (default, May 2015, 09:44:00) [MSC v.1500-bit (AMD64)] on Win32
TYP E "Help", "copyright", "credits" or "license" for the more information.
>>>
>>>
>>>
>>> from flask_sqlalchemy import SQLAlchemy
> >>
>>>
If there are no errors when importing the package, the installation is successful.
To this, flask development environment is done, the next one for actual combat.
Reference documents:
"Flask Fast starter Chinese Version" http://docs.jinkan.org/docs/flask/
"Flask Quick Start English" http://flask.pocoo.org/docs/0.11/
"Flask-sqlalchemy Chinese Version" http://www.pythondoc.com/flask-sqlalchemy/index.html
flask-sqlalchemy Chinese version http://flask-sqlalchemy.pocoo.org/2.1/