Flask is a lightweight WEB application framework written using Python. Its WSGI Toolbox uses Werkzeug, and the template engine uses JINJA2. Many of the features are implemented by reference to the Django framework. Due to the needs of the project, this record the process of learning and experience.
工欲善其事, its prerequisite. Start your flask journey by building a set of flask development environments.
First, platform description
Operating system: Window 7 64bit database: mysql5.6 python:v2.7 Development Integration software: PyCharm5.0
Second, the development environment construction
1. Install Flask Frame Package
1), open the Windows command line: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 the installation is successful
E:\workdir\blog2>pythonpython 2.7.10 (default, May, 09:44:00) [MSC v.1500-bit (AMD64)] on Win32type "Help", "Copyright", "credits" or "license" for more information.>>>>>>>>> from flask import flask >>>
When the import flask package does not have any error, it indicates that flask has been installed successfully.
2. Install Flask-sqlalchemy Package
Flask-sqlalchemy What is this? Start with SQLAlchemy, SQLAlchemy is an open source software under the Python programming language. The SQL Toolkit and Object Relational Mapping (ORM) tools are available, and the Sqlalchmey uses a data mapping model similar to that in Java Hibernate, which is 2006 released as one of the most widely used ORM tools in the Python community, as well as the Django ORM framework.
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 accomplish common tasks more easily.
1), to install SQLAlchemy First, open the Windows command line:pip install sqlalchemy
E:\workdir\blog2>pip Install SQLAlchemy
2), then install Flask-sqlalchemy
E:\workdir\blog2>pip Install Flask-sqlalchemy
3), verify that the Flask-sqlalchemy is installed successfully
E:\workdir\blog2>pythonpython 2.7.10 (default, May, 09:44:00) [MSC v.1500-bit (AMD64)] on Win32type "Help", "Copyright", "credits" or "license" for more information.>>>>>>>>>>>> from Flask_ SQLAlchemy Import sqlalchemy>>>>>>
If you import the package without any error, the installation is successful.
To this, flask's development environment is done, the next one to carry out the actual combat.
Reference documents:
"Flask Quick Start Chinese version" http://docs.jinkan.org/docs/flask/
"Flask Quick Start English version" 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/