Flask the environment to build

Source: Internet
Author: User
Tags virtual environment virtualenv

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


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.